initial commit
This commit is contained in:
commit
2a9f427bc7
21 changed files with 3692 additions and 0 deletions
21
src/app.rs
Normal file
21
src/app.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use axum::Router;
|
||||
use tower_http::trace::TraceLayer;
|
||||
|
||||
use crate::{feeds::Feed, routes};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct AppState {
|
||||
pub feeds: HashMap<String, Feed>,
|
||||
}
|
||||
|
||||
pub fn create(feeds: HashMap<String, Feed>) -> Router {
|
||||
let app_state = Arc::new(AppState { feeds });
|
||||
|
||||
Router::new()
|
||||
.nest("/", routes::all())
|
||||
.with_state(app_state)
|
||||
.layer(TraceLayer::new_for_http())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue