figured out css loading and styling patch 1 for home page.
This commit is contained in:
parent
ad0e00b99b
commit
fd579de898
16
index.html
16
index.html
@ -1,16 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Libcasa-Chan</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="whole-wrapper">
|
||||
<div class="nav-wrapper">
|
||||
<a class="home" href="/">Home</a>
|
||||
</div>
|
||||
<div class="title-wrapper">
|
||||
<h1 class="title">Home</h1>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,7 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Libcasa-Chan</title>
|
||||
<link rel="stylesheet" type="text/css" href="/styles/styles.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="whole-wrapper">
|
||||
@ -12,6 +14,8 @@
|
||||
<div class="title-wrapper">
|
||||
<h1 class="title">Home</h1>
|
||||
</div>
|
||||
<div class="discussion-wrapper">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
30
server.js
30
server.js
@ -2,10 +2,19 @@ const http = require("http");
|
||||
const fs = require("fs");
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
if (req.url === "/styles/styles.css" ) {
|
||||
res.statusCode = 200;
|
||||
res.setHeader("Content-Type", "text/css");
|
||||
fs.readFile("styles/styles.css", function(error, data) {
|
||||
res.write(data);
|
||||
res.end();
|
||||
});
|
||||
}
|
||||
|
||||
if (req.url === "/") {
|
||||
res.statusCode = 200;
|
||||
res.setHeader("Content-Type", "text/html");
|
||||
fs.readFile("index.html", function(error, data) {
|
||||
fs.readFile("./pages/index.html", function(error, data) {
|
||||
if (error) {
|
||||
res.writeHead(404);
|
||||
res.write("Error: File not found.");
|
||||
@ -13,9 +22,24 @@ const server = http.createServer((req, res) => {
|
||||
res.write(data);
|
||||
}
|
||||
res.end();
|
||||
})
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
if (req.url === "/about") {
|
||||
res.statusCode = 200;
|
||||
res.setHeader("Content-Type", "text/html");
|
||||
fs.readFile("./pages/about.html", function(error, data) {
|
||||
if (error) {
|
||||
res.writeHead(404);
|
||||
res.write("Error: File not found.");
|
||||
} else {
|
||||
res.write(data);
|
||||
}
|
||||
res.end();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
const port = process.env.port || 8000;
|
||||
|
||||
|
8
styles/styles.css
Normal file
8
styles/styles.css
Normal file
@ -0,0 +1,8 @@
|
||||
body {
|
||||
background-color: black;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
.title {
|
||||
color: white;
|
||||
}
|
Loading…
Reference in New Issue
Block a user