SQL database is now accessable. CSS and JS implemented

This commit is contained in:
CatAClock 2025-06-20 19:26:04 -07:00
parent be4063d9d5
commit c66a8ae60e
4 changed files with 17 additions and 20 deletions

View file

@ -3,11 +3,15 @@
<head>
<meta charset="utf-8">
<link rel="icon" href="/favicon.ico" type="image/webp" />
<title>Hello!</title>
<link rel="stylesheet" href="/style.css" />
<title>Main</title>
</head>
<body>
<h1>Hello!</h1>
<p>Hi from Rust.</p>
<a href="/Profile">View your profile.</a>
<script src="script.js"></script>
</body>
</html>

View file

@ -1,9 +1,13 @@
body {
text-align: center
text-align: center;
justify-content: center;
}
h1 {
font-size: 10%
font-size: 8ch;
margin-top: 0;
margin-bottom: 0;
}
p {

View file

@ -1,17 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="icon" href="/favicon.ico" type="image/webp" />
<link rel="stylesheet" href="/style.css" />
<title>Main</title>
</head>
<body>
<h1>Hello!</h1>
<p>Hi from Rust.</p>
<a href="/Profile">View your profile.</a>
<script src="script.js"></script>
</body>
</html>

View file

@ -41,6 +41,12 @@ fn main(){
(GET) ["/favicon.ico"] => {
Response::from_file("image/vnd.microsoft.icon", File::open("src/HTTP/favicon.ico").unwrap()).with_status_code(200)
},
(GET) ["/style.css"] => {
Response::from_file("text/css", File::open("src/HTTP/style.css").unwrap()).with_status_code(200)
},
(GET) ["/script.js"] => {
Response::from_file("text/javascript", File::open("src/HTTP/script.js").unwrap()).with_status_code(200)
},
// Catch-all. Fuck you.
_ => {
Response::from_file("text/html", File::open("src/HTTP/404.html").unwrap()).with_status_code(404)