Files
Oxicloud/src/interfaces/web/mod.rs
T
2025-03-24 16:47:42 +01:00

30 lines
791 B
Rust

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<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(static_path)
)
}
/// Serve the login page
async fn serve_login_page() -> Html<&'static str> {
Html(include_str!("../../../static/login.html"))
}