-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (33 loc) · 1.2 KB
/
index.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
37
38
39
40
require('dotenv').config();
const express = require('express');
const engines = require('consolidate');
const csurf = require("csurf");
const cookieParser = require("cookie-parser");
const session = require('express-session');
const csrfProtection = require('./middleware/csrf-protection');
const app = express();
app.engine('njk', engines.nunjucks);
app.set('view engine', 'njk');
app.set('views', __dirname + '/views');
app.use(express.static('public'));
app.use(session({
secret: process.env.SESSION_SECRET,
resave: false,
saveUninitialized: true
}));
app.use(cookieParser());
app.use(csurf());
app.use(require('./middleware/add-config'));
app.use(require('./middleware/authentication'));
app.use(csrfProtection.attach_handler);
require('./routes/authentication')(app);
require('./routes/dashboard')(app);
require('./routes/info')(app);
require('./routes/api')(app);
require('./routes/react-fallback')(app);
// const discord_handler = require("./classes/bot");
// const bot = new discord_handler(app);
app.use(csrfProtection.error_handler);
app.listen(process.env.PORT || 3000, function () {
console.log(`App currently running; navigate to localhost:${process.env.PORT || 3000} in a web browser.`);
});