markdownfs / src /server /ui.rs
Subramanya97's picture
Deploy from markdownfs@89a971f
fe3d8c6
raw
history blame contribute delete
837 Bytes
use axum::http::header;
use axum::response::IntoResponse;
use axum::routing::get;
use axum::Router;
use super::AppState;
const INDEX_HTML: &str = include_str!("assets/index.html");
const STYLE_CSS: &str = include_str!("assets/style.css");
const APP_JS: &str = include_str!("assets/app.js");
pub fn routes() -> Router<AppState> {
Router::new()
.route("/", get(index))
.route("/style.css", get(style))
.route("/app.js", get(app_js))
}
async fn index() -> impl IntoResponse {
([(header::CONTENT_TYPE, "text/html; charset=utf-8")], INDEX_HTML)
}
async fn style() -> impl IntoResponse {
([(header::CONTENT_TYPE, "text/css; charset=utf-8")], STYLE_CSS)
}
async fn app_js() -> impl IntoResponse {
(
[(header::CONTENT_TYPE, "application/javascript; charset=utf-8")],
APP_JS,
)
}