Separated the code

This commit is contained in:
phoenix
2025-03-31 19:16:15 -04:00
parent dda88ce0a0
commit 9b77a8dd78
7 changed files with 57 additions and 26 deletions
+4
View File
@@ -0,0 +1,4 @@
// basic handler that responds with a static string
pub async fn root() -> &'static str {
"Hello, World!"
}
+7
View File
@@ -0,0 +1,7 @@
pub mod common;
pub mod register;
pub mod endpoints {
pub const ROOT: &str = "/";
pub const REGISTER: &str = "api/v2/register";
}
+12
View File
@@ -0,0 +1,12 @@
use axum::{Json, http::StatusCode};
use crate::models;
pub async fn register_user(
Json(payload): Json<models::common::CreateUser>,
) -> (StatusCode, Json<models::common::User>) {
let user = models::common::User {
username: payload.username.clone(),
};
(StatusCode::CREATED, Json(user))
}