cleanup
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
choelzl 2021-07-16 12:17:32 +02:00
parent 4190a23dec
commit 74734113b0
Signed by: sora
GPG Key ID: A362EA0491E2EEA0
2 changed files with 17 additions and 10 deletions

View File

@ -9,19 +9,12 @@ const gen_id = (length)=>{
} }
const query_nominatim = (q,f)=>{ const query_nominatim = (q,f)=>{
const ENDPOINT = 'https://nominatim.openstreetmap.org/'; const ENDPOINT = '/api/place/'+q;
const FORMAT = 'jsonv2'; return axios.get(ENDPOINT).then(res=>res.data).then(res=>res.filter(f));
return axios.get(ENDPOINT, {
params: {
format: FORMAT,
q:q,
},
}).then(res=>res.data).then(res=>res.filter(f));
} }
const query_flight = (q)=>{ const query_flight = (q)=>{
const ENDPOINT = '/api/flight/'+q; const ENDPOINT = '/api/flight/'+q;
const FORMAT = '-';
return axios.get(ENDPOINT).then(res=>res.data); return axios.get(ENDPOINT).then(res=>res.data);
} }

View File

@ -12,7 +12,21 @@ module.exports = (fastify, opts, done) => {
limit:16, limit:16,
type: 'schedule' type: 'schedule'
} }
}).then(res=>{reply.send(res.data)}); }).then(res=>reply.send(res.data));
}else{
reply.send([]);
}
});
fastify.get('/place/:id', async (req,reply) => {
const ENDPOINT = 'https://nominatim.openstreetmap.org/';
const FORMAT = 'jsonv2';
if(req.params.id){
axios.get(ENDPOINT,{
params: {
format: FORMAT,
q: req.params.id,
}
}).then(res=>reply.send(res.data));
}else{ }else{
reply.send([]); reply.send([]);
} }