summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 3faa650..ee7206c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,5 +1,6 @@
mod db;
mod error;
+mod extract;
mod handlers;
mod models;
#[cfg(test)]
@@ -9,6 +10,8 @@ use axum::{Router, routing::get};
use dotenvy::dotenv;
use sqlx::PgPool;
+use crate::error::AppError;
+
fn router(pool: PgPool) -> Router {
Router::new()
.route("/health", get(handlers::health))
@@ -23,6 +26,8 @@ fn router(pool: PgPool) -> Router {
.delete(handlers::delete_measurement),
)
.route("/metric-types", get(handlers::metric_types))
+ .fallback(async || AppError::NotFound)
+ .method_not_allowed_fallback(async || AppError::MethodNotAllowed)
.with_state(pool)
}