servme/src/main.rs

21 lines
456 B
Rust
Raw Normal View History

2025-01-16 18:24:43 +01:00
use http_body_util::Full;
use hyper::{
body::{Bytes, Incoming},
Request, Response,
};
use servme::{Responder, Server};
2025-01-16 18:24:43 +01:00
use std::convert::Infallible;
#[tokio::main]
async fn main() {
Server::builder()
.address("127.0.0.1", 8080)
.build()
.run(handler)
.await
}
async fn handler(req: Request<Incoming>) -> Result<Response<Full<Bytes>>, Infallible> {
Responder::text(&format!("Hello World! {}", req.uri()))
2025-01-16 18:24:43 +01:00
}