This commit is contained in:
CatAClock 2025-06-17 22:54:35 -07:00
parent 0ec60694c7
commit 0a19ee5c33
4 changed files with 4 additions and 1 deletions

View file

@ -2,6 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="icon" href="/favicon.ico" type="image/webp" />
<title>Ouch!</title> <title>Ouch!</title>
</head> </head>
<body> <body>

BIN
src/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

View file

@ -2,6 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="icon" href="/favicon.ico" type="image/webp" />
<title>Hello!</title> <title>Hello!</title>
</head> </head>
<body> <body>

View file

@ -7,7 +7,8 @@ use std::fs::File;
fn main() { fn main() {
rouille::start_server("127.0.0.1:8080", move |Request| { rouille::start_server("127.0.0.1:8080", move |Request| {
router!(Request, router!(Request,
(GET) (/) => { Response::from_file("text/html", File::open("src/index.html").unwrap()).with_status_code(200) }, (GET) ["/"] => { Response::from_file("text/html", File::open("src/index.html").unwrap()).with_status_code(200) },
(GET) ["/favicon.ico"] => { Response::from_file("image/vnd.microsoft.icon", File::open("src/favicon.ico").unwrap()).with_status_code(200) },
_ => { Response::from_file("text/html", File::open("src/404.html").unwrap()).with_status_code(404) } _ => { Response::from_file("text/html", File::open("src/404.html").unwrap()).with_status_code(404) }
) )
}); });