diff options
Diffstat (limited to 'server/src/routes/auth.rs')
-rw-r--r-- | server/src/routes/auth.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/server/src/routes/auth.rs b/server/src/routes/auth.rs index 629ed33..37c41b2 100644 --- a/server/src/routes/auth.rs +++ b/server/src/routes/auth.rs @@ -5,10 +5,13 @@ use crate::models::{ }; use axum::{routing::post, Json, Router}; +/// Create routes for `/v1/auth/` namespace pub fn create_route() -> Router { Router::new().route("/login", post(make_login)) } +/// Make login. Check if a user with the email and password passed in request body exists into the +/// database async fn make_login(Json(payload): Json<UserCreate>) -> Result<Json<AuthBody>, AppError> { let user = User::new(payload.email, payload.password); match User::find(user).await { |