|
|
@ -1,14 +1,11 @@ |
|
|
|
|
|
|
|
|
|
|
|
var service = { mget: require('../service/mget') }; |
|
|
|
var service = { mget: require('../service/mget') }; |
|
|
|
var geojsonify = require('../helper/geojsonify').search; |
|
|
|
var geojsonify = require('../helper/geojsonify').search; |
|
|
|
|
|
|
|
|
|
|
|
function setup( backend ){ |
|
|
|
function setup( backend ){ |
|
|
|
|
|
|
|
|
|
|
|
// allow overriding of dependencies
|
|
|
|
// allow overriding of dependencies
|
|
|
|
backend = backend || require('../src/backend'); |
|
|
|
backend = backend || require('../src/backend'); |
|
|
|
|
|
|
|
|
|
|
|
function controller( req, res, next ){ |
|
|
|
function controller( req, res, next ){ |
|
|
|
|
|
|
|
|
|
|
|
var query = req.clean.ids.map( function(id) { |
|
|
|
var query = req.clean.ids.map( function(id) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
_index: 'pelias', |
|
|
|
_index: 'pelias', |
|
|
@ -18,7 +15,6 @@ function setup( backend ){ |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
service.mget( backend, query, function( err, docs ){ |
|
|
|
service.mget( backend, query, function( err, docs ){ |
|
|
|
|
|
|
|
|
|
|
|
// error handler
|
|
|
|
// error handler
|
|
|
|
if( err ){ return next( err ); } |
|
|
|
if( err ){ return next( err ); } |
|
|
|
|
|
|
|
|
|
|
@ -30,9 +26,7 @@ function setup( backend ){ |
|
|
|
|
|
|
|
|
|
|
|
// respond
|
|
|
|
// respond
|
|
|
|
return res.status(200).json( geojson ); |
|
|
|
return res.status(200).json( geojson ); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return controller; |
|
|
|
return controller; |
|
|
|