2023-01-21 01:18:16 +01:00
|
|
|
const cache = require('memory-cache')
|
|
|
|
const providerCache = new cache.Cache()
|
2023-01-19 12:06:23 +01:00
|
|
|
|
2023-01-21 01:18:16 +01:00
|
|
|
const photon = {
|
2023-01-19 12:06:23 +01:00
|
|
|
commonName: 'Photon',
|
|
|
|
DEFAULT_ENDPOINT: 'https://photon.komoot.io/api/',
|
|
|
|
endpoint: (req, res) => {
|
2023-01-21 01:18:16 +01:00
|
|
|
return res.locals.settings.geocoding_provider || photon.DEFAULT_ENDPOINT
|
2023-01-19 12:06:23 +01:00
|
|
|
},
|
2023-01-21 01:18:16 +01:00
|
|
|
cache: providerCache,
|
2023-01-19 12:06:23 +01:00
|
|
|
|
|
|
|
getParams (req, res) {
|
|
|
|
const details = req.params.place_details
|
|
|
|
|
|
|
|
return {
|
|
|
|
q: details,
|
|
|
|
limit: 3,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-21 01:18:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = photon
|