diff options
author | Santo Cariotti <santo@dcariotti.me> | 2022-08-22 17:13:58 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2022-08-22 17:18:23 +0200 |
commit | 5b32f1eb39f14457a11701095218524fc50f5a73 (patch) | |
tree | 389f30582cc3f8e6485bf2e1720d554d5851874f /server/src | |
parent | bb186c0d67139f076ca8ec1aa99ac0841b3036f3 (diff) |
Move models
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/main.rs | 22 | ||||
-rw-r--r-- | server/src/models/mod.rs | 2 | ||||
-rw-r--r-- | server/src/models/user.rs (renamed from server/src/models/users.rs) | 0 |
3 files changed, 2 insertions, 22 deletions
diff --git a/server/src/main.rs b/server/src/main.rs index 8319fb2..a61e44b 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -5,10 +5,8 @@ mod models; use axum::{ http::{header, Request}, - routing::get, - Json, Router, + Router, }; -use serde::Serialize; use std::time::Duration; use tower_http::sensitive_headers::SetSensitiveHeadersLayer; use tower_http::{classify::ServerErrorsFailureClass, trace::TraceLayer}; @@ -33,7 +31,6 @@ async fn create_app() -> Router { let _ = db::setup().await; Router::new() - .route("/", get(hej)) // Mark the `Authorization` request header as sensitive so it doesn't // show in logs. .layer(SetSensitiveHeadersLayer::new(std::iter::once( @@ -51,20 +48,3 @@ async fn create_app() -> Router { ), ) } - -// Example root which says hi -async fn hej() -> Result<Json<Vec<models::users::User>>, errors::AppError> { - let users = models::users::User::list().await?; - Ok(Json(users)) -} - -#[derive(Debug, Serialize)] -struct Hej { - hello: String, -} - -impl Hej { - fn new(hello: String) -> Self { - Self { hello } - } -} diff --git a/server/src/models/mod.rs b/server/src/models/mod.rs index 913bd46..22d12a3 100644 --- a/server/src/models/mod.rs +++ b/server/src/models/mod.rs @@ -1 +1 @@ -pub mod users; +pub mod user; diff --git a/server/src/models/users.rs b/server/src/models/user.rs index d7a836f..d7a836f 100644 --- a/server/src/models/users.rs +++ b/server/src/models/user.rs |