adding user authentication

This commit is contained in:
DioCrafts
2025-03-20 09:22:31 +01:00
parent 961545aef7
commit cafad0fbfd
69 changed files with 6483 additions and 106 deletions
+22 -3
View File
@@ -1,11 +1,30 @@
use axum::Router;
use axum::{
routing::get,
Router,
response::Html,
};
use tower_http::services::ServeDir;
use std::path::PathBuf;
use std::sync::Arc;
use crate::common::di::AppState;
use crate::common::config::AppConfig;
/// Creates web routes for serving static files
pub fn create_web_routes() -> Router {
pub fn create_web_routes() -> Router<Arc<AppState>> {
// Get config to access static path
let config = AppConfig::from_env();
let static_path = config.static_path.clone();
Router::new()
// Add specific route for login
.route("/login", get(serve_login_page))
// Serve static files
.fallback_service(
ServeDir::new(PathBuf::from("static"))
ServeDir::new(static_path)
)
}
/// Serve the login page
async fn serve_login_page() -> Html<&'static str> {
Html(include_str!("../../../static/login.html"))
}