-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
60 lines (53 loc) · 1.99 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const express = require('express');
const path = require('path');
const app = express();
const bodyParser = require('body-parser');
const session = require('express-session');
const cookieParser = require('cookie-parser');
const Homepage = require('./routes/Homepage');
const Restolist = require('./routes/Restolist');
const Chicken = require('./routes/24Chicken');
const ObscureCafe = require('./routes/ObscureCafe');
const EverythingButCheese = require('./routes/EverythingButCheese');
const GangGangStore = require('./routes/GangGangStore');
const Tahmee = require('./routes/Tahmee');
const Store = require('./routes/Store');
const User = require('./routes/User');
const SearchResult = require('./routes/SearchResult');
const AboutPage = require('./routes/AboutPage');
require('dotenv').config();
require('./db/db');
const upload = require('express-fileupload');
app.use(session({
secret: process.env.SESSION_SECRET,
resave: false,
saveUninitialized: true
}));
const staticPath = path.join(__dirname, './views');
app.use(express.static(staticPath));
app.use(express.json());
app.set('view engine', 'hbs');
app.use(cookieParser())
app.use(bodyParser.json());
app.use(express.urlencoded({ extended: true })); // Middleware to parse form data
app.use(upload());
app.use(express.static('/public'));
app.use(express.static(__dirname + '/public', { maxAge: '30 days' }));
app.use(express.static(__dirname + '/../public'));
app.use(express.static(__dirname + '/static'));
app.use('/uploads', express.static(__dirname + '/uploads'));
app.use('/', Homepage);
app.use('/restolist', Restolist);
app.use('/store', Store);
app.use('/24Chicken', Chicken);
app.use('/ObscureCafe', ObscureCafe);
app.use('/EverythingButCheese', EverythingButCheese);
app.use('/GangGangStore', GangGangStore);
app.use('/Tahmee', Tahmee);
app.use('/User', User);
app.use('/SearchResult', SearchResult);
app.use('/AboutPage', AboutPage);
const port = process.env.PORT || 5000;
app.listen(port, () => {
console.log(`Server Listening on port ${port}`);
});