-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
36 lines (28 loc) · 818 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
'use strict';
const express = require('express'),
bodyParser = require('body-parser'),
apiRoutes = require('./routes/api_routes'),
app = express(),
port = 8080;
app.use((request, response, next) => {
// console.log(request.headers);
next()
});
app.use(bodyParser.text({limit: '50mb'}));
app.use(bodyParser.json({limit: '50mb'}));
app.use('/', express.static('public'));
app.use('/api', apiRoutes);
app.use((err, request, response, next) => {
console.log(err);
response.status(500).send('Something broke!')
});
app.use('*', function (req, res) {
res.redirect('/')
});
let server = app.listen(port, (err) => {
if (err) {
return console.log('something bad happened', err)
}
console.log(`server is listening on ${port}`)
});
server.timeout = 15 * 60 * 1000;