forked from msi-end/WebManAG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
27 lines (20 loc) · 732 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
const express = require('express');
const path = require('path');
const app = express();
const port = process.env.PORT || 3000;
const mainRoute = require('./routes/index-route')
const panels = require('./routes/panels')
app.use('/static', express.static(path.join(__dirname, 'static')));
app.use(express.urlencoded({ extended: true }));
// app.engine('html', require('ejs').renderFile)
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));
app.get('/', (req, res) => {
res.status(200).render('index');
});
app.use('/p', mainRoute);
app.use( panels);
app.get('*', (req, res) => {
res.render('./page/error');
});
app.listen(port, () => { console.log('This site is running on port ' + port) });