diff options
author | Rafael Marçalo <63216029+rafa-99@users.noreply.github.com> | 2022-11-05 20:44:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-05 20:44:56 +0000 |
commit | fd5dc21f2da79298f43ce023a9d84f59c20de620 (patch) | |
tree | 63d3572d212b45228577a1e701fccf0eb05eef9a /app.js | |
parent | 2f9c4d5f287c40125703c98e49ab0658a847d99b (diff) | |
parent | cec82f62825a2ac1ce2ede1ed5cecc72a179ae19 (diff) |
Merge pull request #1 from rafa-99/settings
Settings menu
Diffstat (limited to 'app.js')
-rw-r--r-- | app.js | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -4,10 +4,15 @@ const bodyParser = require('body-parser'); const express = require('express'); const path = require('path'); +var config = require('./server/js/config'); + +// handling variables const app = express(); -const PORT = module.exports.PORT = process.env.PORT || 3000; +const configPath = config.defaultConfigPath; +config.loadConfig(configPath); +const PORT = module.exports.PORT = config.loadedConfig.settings.port || process.env.PORT || 3000; -// 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})); @@ -20,10 +25,13 @@ const home = require("./routes/home"); const info = require("./routes/info"); const search = require("./routes/search"); const visit = require("./routes/visit"); +const {save, settings} = require("./routes/settings"); app.get('/', home); app.get('/info', info); app.get('/visit', visit); +app.get('/settings', settings); +app.post('/settings', save); app.post('/search', search); // app start |