mirror of
https://github.com/tokio-rs/axum.git
synced 2024-12-29 15:49:16 +01:00
8d8cc3ba3d
* Examples readme * link?
20 lines
499 B
Rust
20 lines
499 B
Rust
use awebframework::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>")
|
|
}
|