-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
executable file
·40 lines (37 loc) · 917 Bytes
/
server.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
/**
* Module dependencies.
*/
const express = require('express');
const compression = require('compression');
const bodyParser = require('body-parser');
const methodOverride = require('method-override');
const logger = require('morgan');
const helmet = require('helmet');
const errorhandler = require('errorhandler');
const cors = require('cors');
/**
* Create Express server.
*/
const app = express();
const port = process.env.PORT || 5000;
/**
* Express configuration.
*/
app.set('port', process.env.PORT || 5000);
app.use(compression());
app.use(helmet());
app.use(cors());
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(methodOverride());
/**
* Routes.
*/
app.use(require('./server/routes'));
app.use(errorhandler);
/**
* Start Express server.
*/
app.listen(port, () => console.log(`Listening on port ${port}`));
module.exports = app;