forked from pelias/api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
27 lines (17 loc) · 812 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
var app = require('express')();
var peliasConfig = require( 'pelias-config' ).generate(require('./schema'));
if( peliasConfig.api.accessLog ){
app.use( require( './middleware/access_log' ).createAccessLogger( peliasConfig.api.accessLog ) );
}
/** ----------------------- pre-processing-middleware ----------------------- **/
app.use( require('./middleware/headers') );
app.use( require('./middleware/cors') );
app.use( require('./middleware/options') );
app.use( require('./middleware/jsonp') );
/** ----------------------- routes ----------------------- **/
var v1 = require('./routes/v1');
v1.addRoutes(app, peliasConfig);
/** ----------------------- error middleware ----------------------- **/
app.use( require('./middleware/404') );
app.use( require('./middleware/500') );
module.exports = app;