summaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
authorRafael Marçalo <rafael.marcalo@cast.pt>2022-10-21 02:00:10 +0100
committerRafael Marçalo <rafael.marcalo@cast.pt>2022-10-21 02:00:10 +0100
commitdad891f9d7f060c5d2f4c9f47c410730aa48d5df (patch)
tree8d9bca113b426bb2dd6d5b9884a3ed6e84202f79 /app.js
Added initially developed files
Diffstat (limited to 'app.js')
-rw-r--r--app.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/app.js b/app.js
new file mode 100644
index 0000000..83318c6
--- /dev/null
+++ b/app.js
@@ -0,0 +1,29 @@
+"use strict";
+
+// handling imports
+const express = require('express');
+const bodyParser = require('body-parser');
+const app = express();
+const PORT = 8080;
+
+// set the public folder to public acess and added a body parser
+app.use(express.static('public'));
+app.use(bodyParser.urlencoded({extended: true}));
+
+// set the view engine to ejs
+app.set('view engine', 'ejs');
+
+// routes management
+const home = require("./routes/home");
+const info = require("./routes/info");
+const search = require("./routes/search");
+const settings = require("./routes/settings");
+
+app.get('/', home);
+app.get('/info', info);
+app.get('/settings', settings);
+app.post('/search', search);
+
+// app start
+app.listen(PORT);
+console.log('Server is listening on port ' + PORT); \ No newline at end of file