mirror of https://github.com/pelias/api.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
845 B
31 lines
845 B
|
|
var app = require('express')(); |
|
|
|
var peliasConfig = require( 'pelias-config' ).generate().api; |
|
|
|
|
|
if( peliasConfig.accessLog ){ |
|
app.use( require( './middleware/access_log' )( peliasConfig.accessLog ) ); |
|
} |
|
|
|
/** ----------------------- pre-processing-middleware ----------------------- **/ |
|
|
|
app.use( require('./middleware/headers') ); |
|
app.use( require('./middleware/cors') ); |
|
app.use( require('./middleware/jsonp') ); |
|
|
|
/** ----------------------- routes ----------------------- **/ |
|
|
|
var legacy = require('./routes/legacy'); |
|
legacy.addRoutes(app, peliasConfig); |
|
|
|
var v1 = require('./routes/v1'); |
|
v1.addRoutes(app, peliasConfig); |
|
|
|
/** ----------------------- error middleware ----------------------- **/ |
|
|
|
app.use( require('./middleware/404') ); |
|
app.use( require('./middleware/408') ); |
|
app.use( require('./middleware/500') ); |
|
|
|
module.exports = app; |