create some page templates
This commit is contained in:
parent
25b1644a33
commit
88e92051e3
5 changed files with 51 additions and 2 deletions
|
@ -16,6 +16,8 @@ const users = new FunkyArray<string, RemoteUser>();
|
||||||
|
|
||||||
new Database(Config.database.address, Config.database.port, Config.database.username, Config.database.password, Config.database.name);
|
new Database(Config.database.address, Config.database.port, Config.database.username, Config.database.password, Config.database.name);
|
||||||
|
|
||||||
|
// Web stuff
|
||||||
|
|
||||||
const fastify = Fastify({
|
const fastify = Fastify({
|
||||||
logger: false
|
logger: false
|
||||||
});
|
});
|
||||||
|
@ -30,6 +32,24 @@ fastify.get("/", async (req, res) => {
|
||||||
return res.view("templates/index.ejs", { });
|
return res.view("templates/index.ejs", { });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fastify.get("/account", async (req, res) => {
|
||||||
|
return "TODO";
|
||||||
|
});
|
||||||
|
|
||||||
|
fastify.get("/account/login", async (req, res) => {
|
||||||
|
return res.view("templates/account/login.ejs", { });
|
||||||
|
});
|
||||||
|
|
||||||
|
fastify.get("/account/register", async (req, res) => {
|
||||||
|
return res.view("templates/account/register.ejs", { });
|
||||||
|
});
|
||||||
|
|
||||||
|
fastify.setNotFoundHandler(async (req, res) => {
|
||||||
|
return res.view("templates/404.ejs", { });
|
||||||
|
});
|
||||||
|
|
||||||
|
// Websocket stuff
|
||||||
|
|
||||||
const websocketServer = new WebSocketServer({
|
const websocketServer = new WebSocketServer({
|
||||||
port: Config.ports.ws
|
port: Config.ports.ws
|
||||||
}, () => {
|
}, () => {
|
||||||
|
|
3
server/templates/404.ejs
Normal file
3
server/templates/404.ejs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<%- include("base/header") -%>
|
||||||
|
<h1 class="text-center" style="font-size:10rem">404!</h1>
|
||||||
|
<%- include("base/footer") -%>
|
22
server/templates/account/login.ejs
Normal file
22
server/templates/account/login.ejs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<%- include("../base/header") -%>
|
||||||
|
<h1 class="text-center mb-5">Login</h1>
|
||||||
|
<form>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4"></div>
|
||||||
|
<div class="col-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">Username</label>
|
||||||
|
<input class="form-control" type="text" name="u" maxlength="32" required />
|
||||||
|
</div>
|
||||||
|
<div class="form-group mt-3">
|
||||||
|
<label class="form-label">Password</label>
|
||||||
|
<input class="form-control" type="password" name="p" required />
|
||||||
|
</div>
|
||||||
|
<div class="text-center mt-3">
|
||||||
|
<input class="btn btn-primary" type="submit" value="Login" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-4"></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<%- include("../base/footer") -%>
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en" data-bs-theme="dark">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
@ -20,7 +20,8 @@
|
||||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
<a class="nav-link active" aria-current="page" href="/account/login">Login</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="container pt-3">
|
<div class="container pt-5">
|
3
server/templates/home.ejs
Normal file
3
server/templates/home.ejs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<%- include("base/header") -%>
|
||||||
|
<h1>Welcome back USER!</h1>
|
||||||
|
<%- include("base/footer") -%>
|
Loading…
Reference in a new issue