From a059b91327065e360405e3c216bdb653f6d5c241 Mon Sep 17 00:00:00 2001 From: Doloro1978 Date: Fri, 9 Jan 2026 02:14:44 +0100 Subject: [PATCH] progress --- src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index bfd03e0..ca0a7a3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ use anyhow::Result; use http_body_util::Full; use hyper::body::Incoming; use hyper::service::service_fn; -use hyper::{Request, Response}; +use hyper::{Request, Response, Uri}; use macro_rules_attribute::apply; use smol::{future, io, prelude::*, Async, Executor}; use smol_hyper::rt::{FuturesIo, SmolTimer}; @@ -16,7 +16,12 @@ use smol_macros::main; /// Serves a request and returns a response. async fn serve(req: Request) -> Result>> { println!("Serving {}", req.uri()); - Ok(Response::new(Full::new("Hello from hyper!".as_bytes()))) + let path = req.uri().path(); + let reply = match path { + "/" => "mreow", + _ => "Invalid path!", + }; + Ok(Response::new(Full::new(reply.as_bytes()))) } /// Handle a new client.