forked from betagouv/aides-jeunes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
34 lines (25 loc) · 776 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
var express = require('express');
var errorHandler = require('errorhandler');
var morgan = require('morgan');
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var config = require('./lib/config/config');
// Setup Express
var app = express();
var env = app.get('env');
if ('development' === env) {
app.use(morgan('dev'));
}
if ('production' === env) {
app.use(morgan());
}
// Setup app
app.use('/api', require('sgmap-mesdroits-api'));
require('./lib/config/client')(app, config);
if ('development' === env) {
app.use(errorHandler());
}
// Start server
app.listen(config.port, config.ip, function () {
console.log('Express server listening on %s:%d, in %s mode', config.ip, config.port, app.get('env'));
});
exports = module.exports = app;