|
|
|
@ -16,7 +16,7 @@ function setup(peliasConfig, basePath) {
|
|
|
|
|
config: peliasConfig || require('pelias-config').generate().api, |
|
|
|
|
basePath: basePath || '/' |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function middleware(req, res, next) { |
|
|
|
|
return convertToGeocodeJSON(req, res, next, opts); |
|
|
|
|
} |
|
|
|
@ -56,6 +56,10 @@ function convertToGeocodeJSON(req, res, next, opts) {
|
|
|
|
|
// Helpful for debugging and understanding how the input impacts results.
|
|
|
|
|
res.body.geocoding.query = req.clean; |
|
|
|
|
|
|
|
|
|
// remove arrays produced by the tokenizer (only intended to be used internally).
|
|
|
|
|
delete res.body.geocoding.query.tokens_complete; |
|
|
|
|
delete res.body.geocoding.query.tokens_incomplete; |
|
|
|
|
|
|
|
|
|
// OPTIONAL. Warnings and errors.
|
|
|
|
|
addMessages(req, 'warnings', res.body.geocoding); |
|
|
|
|
addMessages(req, 'errors', res.body.geocoding); |
|
|
|
|