summaryrefslogtreecommitdiff
path: root/src/routes/mod.rs
diff options
context:
space:
mode:
author53hornet <atc@53hor.net>2022-01-01 12:27:41 -0500
committer53hornet <atc@53hor.net>2022-01-01 12:27:41 -0500
commitd7472320a00fa0bfd6b9be904e0730461f093f61 (patch)
treeeadbbfd9a3b82eaafff30d0114fa7c0c7ca66e7d /src/routes/mod.rs
parent5d2c25bf3b196321ded7b7c7ac9ab9a2021fe9c3 (diff)
downloadtwinh-master.tar.xz
twinh-master.zip
chore: pre-ripping-apartHEADmaster
Diffstat (limited to 'src/routes/mod.rs')
-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();