aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 742113e..28036d4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -3,6 +3,7 @@ use axum::{
http::StatusCode,
response::IntoResponse,
routing::{get, post},
+ handler::Handler,
Json, Router
};
@@ -52,7 +53,8 @@ async fn main() {
.timeout(Duration::from_secs(10))
.layer(TraceLayer::new_for_http())
.into_inner(),
- );
+ )
+ .fallback(handler_404.into_service());
let addr = SocketAddr::from_str(std::env::var("BIND_ADDR").unwrap().as_str().into()).unwrap();
tracing::info!("Listening on {}", addr);
@@ -72,3 +74,7 @@ fn get_star() -> Result<Star, errors::ServiceError> {
Ok(Star::new(con_url)?)
}
+
+async fn handler_404() -> impl IntoResponse {
+ StatusCode::NOT_FOUND
+}