handlers.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::errors::{ Result }; use crate::state::{ ApplicationState }; use crate::templates; use axum::extract::{ State }; use axum::response::{ Html }; use std::sync::{ Arc }; pub(crate) async fn index_handler(State(state): State<Arc<ApplicationState>>) -> Result<Html<String>> { let context = templates::index_context(&state)?; let html = state.tera.render("index.tera.html", &context)?; Ok(Html(html)) }