-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
51 lines (40 loc) · 1.26 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const express = require('express');
const bodyParser = require("body-parser");
var flash = require('express-flash');
const session = require("express-session");
const cookieParser = require('cookie-parser');
const expressValidator = require('express-validator');
const { Client } = require('pg');
var conn = require('./db.js');
const index = require('./routes/index.js');
const auth = require('./routes/auth.js');
const landing = require('./routes/landing.js')
const submit = require('./routes/submit.js');
const dashboard = require('./routes/dashboard.js')
const codes = require('./routes/triggercodes.js')
const app = express();
app.set('view engine', 'ejs');
app.set('views', './views');
app.use(flash());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
var sixDays = 6 * 24 * 3600 * 1000;
app.use(cookieParser());
app.use(session({
secret: "AS333ProfBremner",
resave: false,
saveUninitialized: true,
cookie: { maxAge: sixDays }
}));
app.use(expressValidator());
app.use('/', index);
app.use('/', landing);
app.use('/', auth);
app.use('/',submit);
app.use('/',dashboard);
app.use('/',codes);
app.get('*', (req, res) => {
res.sendFile(__dirname+"/public/404.html");
});
port = process.env.PORT || 80;
var server = app.listen(port)