main.rs (1370B)
1 use askama::Template; 2 use axum::{response::Redirect, routing::get, Router}; 3 4 const COLORS: [&str; 19] = [ 5 "AccentColor", 6 "AccentColorText", 7 "ActiveText", 8 "ButtonBorder", 9 "ButtonFace", 10 "ButtonText", 11 "Canvas", 12 "CanvasText", 13 "Field", 14 "FieldText", 15 "GrayText", 16 "Highlight", 17 "HighlightText", 18 "LinkText", 19 "Mark", 20 "MarkText", 21 "SelectedItem", 22 "SelectedItemText", 23 "VisitedText", 24 ]; 25 const DEPRECATED: [&str; 23] = [ 26 "ActiveBorder", 27 "ActiveCaption", 28 "AppWorkspace", 29 "Background", 30 "ButtonHighlight", 31 "ButtonShadow", 32 "CaptionText", 33 "InactiveBorder", 34 "InactiveCaption", 35 "InactiveCaptionText", 36 "InfoBackground", 37 "InfoText", 38 "Menu", 39 "MenuText", 40 "Scrollbar", 41 "ThreeDDarkShadow", 42 "ThreeDFace", 43 "ThreeDHighlight", 44 "ThreeDLightShadow", 45 "ThreeDShadow", 46 "Window", 47 "WindowFrame", 48 "WindowText", 49 ]; 50 51 #[derive(Template)] 52 #[template(path = "index.html")] 53 struct IndexTemplate {} 54 55 #[tokio::main] 56 async fn main() { 57 let app = Router::new() 58 .route("/", get(root)) 59 .fallback(|| async { Redirect::to("/") }); 60 let listener = tokio::net::TcpListener::bind("0.0.0.0:3000") 61 .await 62 .unwrap(); 63 axum::serve(listener, app).await.unwrap(); 64 } 65 66 async fn root() -> IndexTemplate { 67 IndexTemplate {} 68 }