-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathapp.js
36 lines (31 loc) · 922 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const express = require("express");
const hbs = require('express-handlebars');
const path = require('path');
const panel = require("./panel/panel");
const helpers = require('./panel/helpers');
const api = require("./api/api");
const start = process.argv.slice(2)[0];
const port = 80;
const app = express();
app.engine('hbs', hbs.engine({
extname: '.hbs',
partialsDir: [
'panel/views/partials/'
],
helpers: helpers.helpers,
defaultLayout: false
}));
app.set("view engine", 'hbs');
app.set('views', path.join(__dirname, 'panel', 'views'));
app.use(express.static(path.join(__dirname, 'panel', 'public')));
if (start == 'maintenance') {
app.get('/*', async (req, res) => {
res.render('maintenance')
})
} else {
app.use('/api', api);
app.use('/panel', panel);
app.listen(port, () => {
console.log(`Application successfully started on port ${port}`)
})
}