last minute thing

This commit is contained in:
CatAClock 2025-06-17 23:05:11 -07:00
parent 0a19ee5c33
commit 610a8853bb
3 changed files with 18 additions and 1 deletions

View file

@ -7,6 +7,7 @@
</head>
<body>
<h1>Hello!</h1>
<p>Hi from Rust</p>
<p>Hi from Rust.</p>
<a href="/Profile">View your profile.</a>
</body>
</html>

View file

@ -6,9 +6,13 @@ use std::fs::File;
fn main() {
rouille::start_server("127.0.0.1:8080", move |Request| {
// Router. Go to the correct pages, else hit the sack.
router!(Request,
(GET) ["/"] => { Response::from_file("text/html", File::open("src/index.html").unwrap()).with_status_code(200) },
(GET) ["/Profile"] => { Response::from_file("text/html", File::open("src/profile.html").unwrap()).with_status_code(200) },
// Get specific images. Because the browser said so.
(GET) ["/favicon.ico"] => { Response::from_file("image/vnd.microsoft.icon", File::open("src/favicon.ico").unwrap()).with_status_code(200) },
// Catch-all. Fuck you.
_ => { Response::from_file("text/html", File::open("src/404.html").unwrap()).with_status_code(404) }
)
});

12
src/profile.html Normal file
View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="icon" href="/favicon.ico" type="image/webp" />
<title>Hello!</title>
</head>
<body>
<h1>Profile!</h1>
<p>This is totally your profile girl.</p>
</body>
</html>