-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
37 lines (34 loc) · 933 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
var express = require('express');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
const routes = require('./api/routes');
var db = require('./api/daos/index');
var expressWinston = require('express-winston');
var winston = require('winston');
//Port on which server will run
const port = 4000;
var app = express();
app.use(bodyParser.json({ limit: '50mb' }));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
//Middleware which will log request
app.use(expressWinston.logger({
transports: [
new winston.transports.Console({
json: true,
colorize: true
})
]
}));
app.use('/', routes);
app.use(expressWinston.errorLogger({
transports: [
new winston.transports.Console({
json: true,
colorize: true
})
]
}));
//server started
app.listen(port);
console.log('Server started on port ' + port);