2025-03-22 22:17:47 -04:00
|
|
|
pub mod auth;
|
|
|
|
use axum::{
|
|
|
|
Router,
|
|
|
|
routing::{get, post},
|
|
|
|
};
|
|
|
|
use serde::Deserialize;
|
|
|
|
|
|
|
|
pub fn routes() -> Router {
|
|
|
|
Router::new()
|
2025-03-23 16:37:43 -04:00
|
|
|
// auth
|
2025-03-22 22:17:47 -04:00
|
|
|
// global
|
|
|
|
.route("/auth/register", post(auth::register_request))
|
|
|
|
.route("/auth/login", post(auth::login_request))
|
2025-03-23 16:37:43 -04:00
|
|
|
.route("/auth/logout", post(auth::logout_request))
|
2025-03-22 22:17:47 -04:00
|
|
|
// profile
|
|
|
|
.route(
|
|
|
|
"/auth/profile/{id}/avatar",
|
|
|
|
get(auth::images::avatar_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/auth/profile/{id}/banner",
|
|
|
|
get(auth::images::banner_request),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct AuthProps {
|
|
|
|
pub username: String,
|
|
|
|
pub password: String,
|
|
|
|
}
|