From 251f4fa4425b26db6363e08898a0a18e47a6dbd0 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 22 Jun 2022 19:41:58 +0200 Subject: [PATCH] use express and ejs --- src/index.js | 0 src/routes/index.js | 8 ++++++++ src/server.js | 13 +++++++++++++ src/views/index.ejs | 12 ++++++++++++ 4 files changed, 33 insertions(+) delete mode 100644 src/index.js create mode 100644 src/routes/index.js create mode 100644 src/server.js create mode 100644 src/views/index.ejs diff --git a/src/index.js b/src/index.js deleted file mode 100644 index e69de29..0000000 diff --git a/src/routes/index.js b/src/routes/index.js new file mode 100644 index 0000000..3ebda34 --- /dev/null +++ b/src/routes/index.js @@ -0,0 +1,8 @@ +const router = require('express').Router(); + +// Home Page +router.get('/', (_, res) => { + res.render('index'); +}); + +module.exports = router; diff --git a/src/server.js b/src/server.js new file mode 100644 index 0000000..81e745f --- /dev/null +++ b/src/server.js @@ -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}.`); +}); diff --git a/src/views/index.ejs b/src/views/index.ejs new file mode 100644 index 0000000..faa76ee --- /dev/null +++ b/src/views/index.ejs @@ -0,0 +1,12 @@ + + + + + + + Constnium + + + + +