first commit, small server servme

This commit is contained in:
2025-01-16 18:24:43 +01:00
commit 79db275dc9
8 changed files with 570 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
use http_body_util::Full;
use hyper::{
body::{Bytes, Incoming},
Request, Response,
};
use servme::Server;
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> {
Ok(Response::new(Full::new(Bytes::from(format!(
"Hello World! {}",
req.uri()
)))))
}