initial commit

This commit is contained in:
Sebastian Hugentobler 2023-11-15 16:26:35 +01:00
commit 2a9f427bc7
Signed by: shu
GPG key ID: BB32CF3CA052C2F0
21 changed files with 3692 additions and 0 deletions

21
src/app.rs Normal file
View 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())
}