first commit

This commit is contained in:
Romulus21 committed 2026-10-26 13:21:14 +01:00
commit dd6a740645
37 files changed
+5424

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
mod api;
mod pages;
use axum::Router;
use axum::http::header;
use axum::response::IntoResponse;
use axum::routing::get;
use sqlx::SqlitePool;
use tower_http::trace::TraceLayer;
pub fn app(pool: SqlitePool) -> Router {
Router::new()
.merge(pages::router())
.nest("/api", api::router())
.route("/health", get(|| async { "ok" }))
.route(
"/static/htmx.min.js",
get(|| asset("text/javascript", include_str!("../../static/htmx.min.js"))),
)
.route(
"/static/app.js",
get(|| asset("text/javascript", include_str!("../../static/app.js"))),
)
.route(
"/static/app.css",
get(|| asset("text/css", include_str!("../../static/app.css"))),
)
.layer(TraceLayer::new_for_http())
.with_state(pool)
}
async fn asset(content_type: &'static str, body: &'static str) -> impl IntoResponse {
(
[
(header::CONTENT_TYPE, content_type),
(header::CACHE_CONTROL, "public, max-age=3600"),
],
body,
)
}