61 lines
1.5 KiB
TypeScript
61 lines
1.5 KiB
TypeScript
import { getCity, getRadius } from "./openTripMaps"
|
|
import express from "express"
|
|
/**
|
|
* Initialize Express application instance.
|
|
* @returns An initialized Express application object.
|
|
*/
|
|
const app = express()
|
|
|
|
|
|
|
|
/**
|
|
* Handle GET request for homepage route ('/welcome').
|
|
* Send back a simple json response.
|
|
* @param {express.Request} req - HTTP Request object.
|
|
* @param {express.Response} res - HTTP Response object.
|
|
*/
|
|
function getWelcome(req: express.Request, res: express.Response) {
|
|
const out = {hello:"world"}
|
|
res.send(out)
|
|
}
|
|
|
|
/**
|
|
* @openapi
|
|
* /welcome:
|
|
* get:
|
|
* summary: retun just hello
|
|
* description: Welcome to swagger-jsdoc!
|
|
* responses:
|
|
* 200:
|
|
* description: Returns a welcome json.
|
|
*/
|
|
app.get("/welcome", getWelcome)
|
|
|
|
/**
|
|
* @openapi
|
|
* /otm/city:
|
|
* get:
|
|
* summary: return the drinks in a city
|
|
* description: return the drinks in a defined perimeter in a city
|
|
* parameters:
|
|
* - name: name
|
|
* in: query
|
|
* required: true
|
|
* description: the name of the city
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Return a list of bars and coffee in city in geoJSON format
|
|
* 400:
|
|
* description: Missing Argument Error
|
|
* 401:
|
|
* description: Missing OTM tocken
|
|
*/
|
|
app.get("/otm/city", getCity)
|
|
|
|
|
|
//XXX: faire la doc SWAGGER
|
|
app.get("/otm/radius", getRadius)
|
|
|
|
export default app |