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.
36 lines
1.4 KiB
36 lines
1.4 KiB
/** ----------------------- sanitisers ----------------------- **/ |
|
var sanitisers = {}; |
|
sanitisers.place = require('../sanitiser/place'); |
|
sanitisers.suggest = require('../sanitiser/suggest'); |
|
sanitisers.search = require('../sanitiser/search'); |
|
sanitisers.coarse = require('../sanitiser/coarse'); |
|
sanitisers.reverse = require('../sanitiser/reverse'); |
|
|
|
/** ----------------------- controllers ----------------------- **/ |
|
|
|
var controllers = {}; |
|
controllers.index = require('../controller/index'); |
|
controllers.place = require('../controller/place'); |
|
controllers.search = require('../controller/search'); |
|
|
|
function addRoutes(app) { |
|
// api root |
|
app.get( '/', controllers.index() ); |
|
|
|
// place API |
|
app.get( '/place', sanitisers.place.middleware, controllers.place() ); |
|
|
|
// suggest APIs |
|
app.get( '/suggest', sanitisers.search.middleware, controllers.search() ); |
|
app.get( '/suggest/nearby', sanitisers.suggest.middleware, controllers.search() ); |
|
app.get( '/suggest/coarse', sanitisers.coarse.middleware, controllers.search() ); |
|
|
|
// search APIs |
|
app.get( '/search', sanitisers.search.middleware, controllers.search() ); |
|
app.get( '/search/coarse', sanitisers.coarse.middleware, controllers.search() ); |
|
|
|
// reverse API |
|
app.get( '/reverse', sanitisers.reverse.middleware, controllers.search(undefined, require('../query/reverse')) ); |
|
} |
|
|
|
module.exports.addRoutes = addRoutes;
|
|
|