summaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
authorRafael Marçalo <raroma09@gmail.com>2022-10-28 00:40:47 +0100
committerRafael Marçalo <raroma09@gmail.com>2022-10-28 00:40:47 +0100
commit48591e37a58d5349214e0bfee9f76e201d45e7bf (patch)
tree86f25c6bda760ed6354b3df77afe24017bd1caba /app.js
parent2f9c4d5f287c40125703c98e49ab0658a847d99b (diff)
Started working on settings menu
Diffstat (limited to 'app.js')
-rw-r--r--app.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/app.js b/app.js
index da2a3b7..d87b6e0 100644
--- a/app.js
+++ b/app.js
@@ -4,12 +4,20 @@
const bodyParser = require('body-parser');
const express = require('express');
const path = require('path');
+
+// handling variables
const app = express();
+const { ensureFolder, envPaths } = require('./server/js/paths');
+const loadConfig = require('./server/js/config').loadConfig;
+const configFolder = ensureFolder(path.join(envPaths.CONFIG, 'sneedbay'));
+const configPath = path.join(configFolder, 'config.json');
const PORT = module.exports.PORT = process.env.PORT || 3000;
+var config = require('./server/js/config').config;
-// set the public folder to public acess and added a body parser
+// loading configurations
app.use(express.static(path.join(__dirname, '/public')));
app.use(bodyParser.urlencoded({extended: true}));
+config = loadConfig(configPath);
// set the view engine to ejs
app.set('view engine', 'ejs');
@@ -20,10 +28,12 @@ const home = require("./routes/home");
const info = require("./routes/info");
const search = require("./routes/search");
const visit = require("./routes/visit");
+const settings = require("./routes/settings");
app.get('/', home);
app.get('/info', info);
app.get('/visit', visit);
+app.get('/settings', settings);
app.post('/search', search);
// app start