use axum::response::{Html, IntoResponse};
use crate::core::view::View;
pub struct HomeController;
impl HomeController {
pub async fn index(req: crate::core::request::Request) -> impl IntoResponse {
View::make("home.index")
.render(&req)
.await
}
pub async fn about(req: crate::core::request::Request) -> impl IntoResponse {
View::make("home.about")
.with("title", "About Lumina")
.render(&req)
.await
}
pub async fn debug_panic() -> Html<String> {
panic!("Sengaja dibuat panic untuk testing halaman error 500 Lumina!");
}
pub async fn debug_dd() -> Html<String> {
let sample_data = serde_json::json!({
"framework": "Lumina",
"version": "0.1.0",
"features": ["MVC", "Routing", "ORM", "Auth", "Debugging"],
"server": {
"address": "127.0.0.1",
"port": 8000,
"os": "Windows"
}
});
crate::dd!(sample_data);
#[allow(unreachable_code)]
Html("This will never be reached".to_string())
}
}