registration page initiated.

This commit is contained in:
sweatshirt0 2023-01-27 00:51:41 -05:00
parent c9967f50f3
commit 6c07e9eb3b
3 changed files with 31 additions and 0 deletions

View File

@ -10,6 +10,7 @@
<div class="nav-wrapper"> <div class="nav-wrapper">
<a class="home" href="/">Home</a> <a class="home" href="/">Home</a>
<a class="about" href="/about">About</a> <a class="about" href="/about">About</a>
<a class="register" href="/register">Register</a>
</div> </div>
<div class="title-wrapper"> <div class="title-wrapper">
<h1 class="title">CasaChan</h1> <h1 class="title">CasaChan</h1>

15
pages/register.html Normal file
View File

@ -0,0 +1,15 @@
<html>
<head>
<meta charse="UTF-8" />
<title>Register</title>
</head>
<body>
<div class="whole-wrapper">
<div class="register-wrapper">
<form class="register-form" action="register.js" method="POST">
<input type="text" class="username" id="username" placeholder="Username" />
</form>
</div>
</div>
</body>
</html>

View File

@ -39,6 +39,21 @@ const server = http.createServer((req, res) => {
}); });
} }
if (req.url === "/register") {
res.statusCode = 200;
res.setHeader("Content-Type", "text/html");
fs.readFile("./pages/register.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; const port = process.env.port || 8000;