feat: open-trip-api-drink #11

Merged
Clement merged 34 commits from feat/open-trip-api into master 2024-05-19 09:38:39 +00:00
Showing only changes of commit 30d1e62b81 - Show all commits

View File

@ -3,9 +3,15 @@ import express from "express"
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
dotenv.config({path: '../../.env'}) dotenv.config({path: '../../.env'})
const key = process.env.OPEN_TRIP_MAPS_KEY const key = process.env.OPEN_TRIP_MAPS_KEY
/**
* make GET request to the OTM for radius search.
* @param {string} lon Longitude of radius center point
* @param {string} lat Latitude du point central du rayon
* @param {string} radius search radius size in meters
* @returns {FeatureCollection} a list of POIs with their type, id, etc. (cf: [opentripmap](https://dev.opentripmap.org/docs#))
*/
async function callRadius(lon: string, lat: string, radius = '1000') { async function callRadius(lon: string, lat: string, radius = '1000') {
const optionsDrink = { const optionsDrink = {
method: 'GET', method: 'GET',
@ -28,7 +34,11 @@ async function callRadius(lon: string, lat: string, radius = '1000') {
} }
} }
/**
* make GET request to the OTM for city info.
* @param {string} name Name of a city
* @returns {Geoname} info of a search city their name, country, lat, lon, etc. (cf: [opentripmap](https://dev.opentripmap.org/docs#))
*/
async function callCity(name:string) { async function callCity(name:string) {
const optionsCity = { const optionsCity = {
method: 'GET', method: 'GET',
@ -70,7 +80,7 @@ export async function getCity(req: express.Request, res: express.Response) {
} }
/** /**
* Handle GET request for city search route ('/otm/radius'). * Handle GET request for radius search route ('/otm/radius').
* @param {express.Request} req - HTTP Request object. * @param {express.Request} req - HTTP Request object.
* @param {express.Response} res - HTTP Response object. * @param {express.Response} res - HTTP Response object.
*/ */