use express and ejs

This commit is contained in:
Mylloon 2022-06-22 19:41:58 +02:00
parent 0537c8129a
commit 251f4fa442
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
4 changed files with 33 additions and 0 deletions

View file

8
src/routes/index.js Normal file
View file

@ -0,0 +1,8 @@
const router = require('express').Router();
// Home Page
router.get('/', (_, res) => {
res.render('index');
});
module.exports = router;

13
src/server.js Normal file
View file

@ -0,0 +1,13 @@
const express = require('express');
const app = express();
const port = 3000;
app.set('views', 'src/views');
app.set('view engine', 'ejs');
app.use('/', require('./routes'));
app.listen(port, () => {
console.log(`Constnium started on port ${port}.`);
});

12
src/views/index.ejs Normal file
View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Constnium</title>
</head>
<body>
</body>
</html>