feat: fixup "add a DEBUG page to the UI with a database usage example"
This commit is contained in:
@ -7,6 +7,7 @@ use thiserror::Error;
|
||||
|
||||
use ::utils::config::{load_config, ConfigError};
|
||||
|
||||
mod api;
|
||||
mod db;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
@ -27,10 +28,13 @@ pub struct AppState {
|
||||
|
||||
pub async fn get_router() -> Result<Router, DbErr> {
|
||||
let db_connection = db::get_connection().await?;
|
||||
let state: AppState = AppState { db_connection };
|
||||
|
||||
Ok(Router::new()
|
||||
.route("/", get(|| async { "Hello, world!" }))
|
||||
.fallback(fallback))
|
||||
.merge(api::get_routes())
|
||||
.fallback(fallback)
|
||||
.with_state(state))
|
||||
}
|
||||
|
||||
async fn fallback(uri: Uri) -> (StatusCode, String) {
|
||||
|
Reference in New Issue
Block a user