add favicon
This commit is contained in:
parent
ba15f8ed0c
commit
8121dbcb7c
10
src/main.rs
10
src/main.rs
|
@ -7,6 +7,7 @@ use axum::{
|
|||
routing::{get, post},
|
||||
Form, Json, Router,
|
||||
};
|
||||
use hyper::{header, HeaderMap};
|
||||
use serde::Deserialize;
|
||||
use sqlx::{query, SqlitePool};
|
||||
use std::{env, net::SocketAddr};
|
||||
|
@ -35,6 +36,7 @@ async fn main() {
|
|||
.nest_service("/static", ServeDir::new(static_path))
|
||||
.route("/", get(register_form))
|
||||
.route("/register/", post(register))
|
||||
.route("/favicon.ico", get(favicon))
|
||||
.with_state(db_pool);
|
||||
|
||||
// run it
|
||||
|
@ -131,3 +133,11 @@ where
|
|||
{
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, err.to_string())
|
||||
}
|
||||
|
||||
async fn favicon() -> impl IntoResponse {
|
||||
let mut headers = HeaderMap::new();
|
||||
headers.insert(header::CONTENT_TYPE, "image/x-icon".parse().unwrap());
|
||||
|
||||
let bytes = include_bytes!("../static/favicon.ico");
|
||||
(headers, bytes)
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Loading…
Reference in New Issue