From d7472320a00fa0bfd6b9be904e0730461f093f61 Mon Sep 17 00:00:00 2001 From: 53hornet Date: Sat, 1 Jan 2022 12:27:41 -0500 Subject: chore: pre-ripping-apart --- src/routes/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/routes') diff --git a/src/routes/mod.rs b/src/routes/mod.rs index be07aa0..1948657 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -9,6 +9,7 @@ use serde::{Deserialize, Serialize}; pub async fn router(req: Request) -> Result, TwinHError> { match (req.method(), req.uri().path()) { + (&Method::GET, "/favicon.ico") | (&Method::GET, "/favicon.svg") => favicon(), (&Method::GET, "/") => index(req).await, (&Method::GET, "/cars") => cars(req).await, (&Method::GET, "/login") => login().await, @@ -128,6 +129,14 @@ async fn cars(req: Request) -> Result, TwinHError> { todo!() } +fn favicon() -> Result, TwinHError> { + let resp = Response::builder() + .header(hyper::header::CONTENT_TYPE, "image/svg+xml") + .body(templates::FAVICON.into()) + .unwrap(); + Ok(resp) +} + async fn index(req: Request) -> Result, TwinHError> { let query = req.uri().query().unwrap_or_default(); let filter = serde_urlencoded::de::from_str::(query).unwrap(); -- cgit v1.2.3