summaryrefslogtreecommitdiff
path: root/src/routes
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/mod.rs9
1 files changed, 9 insertions, 0 deletions
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<Body>) -> Result<Response<Body>, 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<Body>) -> Result<Response<Body>, TwinHError> {
todo!()
}
+fn favicon() -> Result<Response<Body>, 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<Body>) -> Result<Response<Body>, TwinHError> {
let query = req.uri().query().unwrap_or_default();
let filter = serde_urlencoded::de::from_str::<PartsQuery>(query).unwrap();