findpenguins-feed/src/app.rs

22 lines
456 B
Rust

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())
}