2025-01-15 18:28:59 +01:00
|
|
|
use based::get_pg;
|
2024-12-24 02:12:16 +01:00
|
|
|
use based::request::{RequestContext, StringResponse};
|
2025-01-15 18:28:59 +01:00
|
|
|
use based::ui::components::Shell;
|
2025-01-21 16:39:47 +01:00
|
|
|
use based::ui::prelude::Nothing;
|
2024-12-24 02:12:16 +01:00
|
|
|
use maud::html;
|
|
|
|
use rocket::get;
|
|
|
|
use rocket::routes;
|
|
|
|
|
|
|
|
#[get("/")]
|
|
|
|
pub async fn index_page(ctx: RequestContext) -> StringResponse {
|
|
|
|
let content = html!(
|
|
|
|
h1 { "Hello World!" };
|
|
|
|
);
|
|
|
|
|
2025-01-21 16:39:47 +01:00
|
|
|
Shell::new(Nothing(), Nothing(), Nothing())
|
|
|
|
.render_page(content, "Hello World", ctx)
|
|
|
|
.await
|
2024-12-24 02:12:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[rocket::launch]
|
|
|
|
async fn launch() -> _ {
|
|
|
|
// Logging
|
|
|
|
env_logger::init();
|
|
|
|
|
|
|
|
// Database
|
|
|
|
let pg = get_pg!();
|
|
|
|
// sqlx::migrate!("./migrations").run(pg).await.unwrap();
|
|
|
|
|
|
|
|
rocket::build().mount("/", routes![index_page])
|
|
|
|
}
|