feat/ make function documentary
This commit is contained in:
parent
1d6b334c74
commit
30d1e62b81
@ -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.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user