diff options
author | Santo Cariotti <santo@dcariotti.me> | 2022-08-23 18:57:16 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2022-08-23 18:57:16 +0200 |
commit | 2231ab6730552d3b58b00ae42d490743a29d7c8b (patch) | |
tree | 4a9612ec08398b8abc2e4ce7c30825f7ef18659c /server/src/routes/auth.rs | |
parent | bba5f252f265e6102d2f052e9ca100efe318508f (diff) |
Add docs
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 { |