Added router for routing requests

1. Duh
2. Also minor bugfix
This commit is contained in:
2026-04-22 21:27:08 +02:00
parent 20a0534c76
commit d890255631
3 changed files with 28 additions and 8 deletions

View File

@@ -1,6 +1,9 @@
#![allow(unused_imports)]
mod handlers;
mod models;
mod router;
use std::sync::Arc;
use axum::{Router, routing};
use dotenv::dotenv;
use models::*;
@@ -26,12 +29,7 @@ async fn main() {
std::process::exit(1);
}
};
let app = Router::new().route("/", routing::get(root_handler));
let app = create_router(Arc::new(AppState { db: pool.clone() }));
let listener = tokio::net::TcpListener::bind("0.0.0.0:8001").await.unwrap();
axum::serve(listener, app).await;
}
async fn root_handler() -> &'static str {
"Hello, World"
}