diff options
| author | Santo Cariotti <santo@dcariotti.me> | 2022-10-17 20:08:09 +0000 |
|---|---|---|
| committer | Santo Cariotti <santo@dcariotti.me> | 2022-10-17 20:08:09 +0000 |
| commit | 74976dab57887a4d7e29b426cdf7422722fa58ee (patch) | |
| tree | 5f1bbed3dbcf3ba520866cb4eb060aaf5a771915 /src/routes/mod.rs | |
| parent | 611293122213f83e82d851cd8dc83fd1e4f79dcd (diff) | |
Refactoring of mods
Diffstat (limited to 'src/routes/mod.rs')
| -rw-r--r-- | src/routes/mod.rs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/routes/mod.rs b/src/routes/mod.rs deleted file mode 100644 index a0e8031..0000000 --- a/src/routes/mod.rs +++ /dev/null @@ -1,28 +0,0 @@ -pub mod auth; -pub mod model; -pub mod user; -pub mod warning; - -use crate::errors::AppError; -use axum::{ - http::StatusCode, - response::{IntoResponse, Response}, - Json, -}; -use serde::Serialize; - -pub async fn page_404() -> impl IntoResponse { - AppError::NotFound("Route not found".to_string()) -} - -/// Extension of `Json` which returns the CREATED status code -pub struct JsonCreate<T>(pub T); - -impl<T> IntoResponse for JsonCreate<T> -where - T: Serialize, -{ - fn into_response(self) -> Response { - (StatusCode::CREATED, Json(self.0)).into_response() - } -} |
