summaryrefslogtreecommitdiff
path: root/src/handlers/mod.rs
diff options
context:
space:
mode:
authorWriterV2 <primary-v2@protonmail.com>2024-10-27 13:58:51 +0100
committerWriterV2 <primary-v2@protonmail.com>2024-10-27 14:00:34 +0100
commit04e19765aca471fd85199714699aaf827d04608d (patch)
treea2bfa782c1db2a6b783206087309a9eed3c6e9b9 /src/handlers/mod.rs
parente074949d96fe29929e99890b3035dc1a5ba57184 (diff)
Refactor: Organize modules initially
Diffstat (limited to 'src/handlers/mod.rs')
-rw-r--r--src/handlers/mod.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
new file mode 100644
index 0000000..d69f590
--- /dev/null
+++ b/src/handlers/mod.rs
@@ -0,0 +1,21 @@
+use axum::extract::DefaultBodyLimit;
+use axum::middleware::{self};
+use axum::routing::get;
+use axum::Router;
+use sqlx::SqlitePool;
+use tower_http::services::ServeDir;
+
+use admin::{admin_handler, admin_middleware};
+use frontend::home;
+
+mod admin;
+mod frontend;
+
+pub async fn router(pool: SqlitePool) -> Router {
+ Router::new()
+ .route("/admin", get(admin_handler))
+ .layer(middleware::from_fn(admin_middleware))
+ .route("/", get(home))
+ .nest_service("/static", ServeDir::new("src/static"))
+ .layer(DefaultBodyLimit::max(10000))
+}