blob: ac4cd8882eb6d38a78ebb13138df8d44595f7523 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
use axum::prelude::*;
use std::net::SocketAddr;
#[tokio::main]
async fn main() {
// build our application with a route
let app = route("/", get(handler));
// run it
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
tracing::debug!("listening on {}", addr);
hyper::Server::bind(&addr)
.serve(app.into_make_service())
.await
.unwrap();
}
async fn handler() -> response::Html<&'static str> {
response::Html("<h1>Hello, World!</h1>")
}
|