rust backend, example nix container building
This commit is contained in:
19
src/main.rs
Normal file
19
src/main.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use axum::{
|
||||
routing::get,
|
||||
Router,
|
||||
response::Html,
|
||||
};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let site = Router::new().route("/", get(root));
|
||||
|
||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
|
||||
println!("Running on http://127.0.0.1:3000");
|
||||
axum::serve(listener, site).await.unwrap();
|
||||
}
|
||||
|
||||
async fn root() -> Html<&'static str> {
|
||||
const HTML: &str = include_str!("../static/root.html");
|
||||
Html(HTML)
|
||||
}
|
||||
Reference in New Issue
Block a user