Two endpoints power the map view in AirGuide.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/luiss811/Backend-Airguide/llms.txt
Use this file to discover all available pages before exploring further.
GET /api/mapa/data returns a GeoJSON FeatureCollection that your client can render directly — it combines building point markers with geographic path geometries imported from OpenStreetMap. POST /api/google/compute-route acts as an authenticated proxy to the Google Routes API v2, calculating a walking route between any two coordinates without exposing your API key to the client.
GET /api/mapa/data
Returns a GeoJSONFeatureCollection that combines all active buildings and all active geographic paths on campus. No authentication is required.
GeoJSON coordinates follow the standard
[longitude, latitude] order, not the more common [latitude, longitude] order used elsewhere in this API. Make sure your mapping library (e.g. Leaflet, Mapbox GL) reads coordinates correctly.Response — 200 OK
Always
"FeatureCollection".Array of GeoJSON Feature objects. Contains both building point features and path line features.
Example
POST /api/google/compute-route
Proxies a walking route calculation to the Google Routes API v2 (routes.googleapis.com). The server attaches the GOOGLE_ROUTES_API_KEY and requests only the fields routes.duration, routes.distanceMeters, and routes.polyline.encodedPolyline. Authentication via Bearer token is required so that the API key is never exposed in client code.
This endpoint always uses
travelMode: WALK and languageCode: es-MX with metric units. Alternative routes are not computed.Request headers
Bearer token for any authenticated user:
Bearer <token>.Request body
Starting point coordinates.
Ending point coordinates.
Google routing preference value passed through to the Routes API. Defaults to
TRAFFIC_UNAWARE.Response — 200 OK
The unmodified JSON response body from the Google Routes API v2. Key fields in the response:Array of computed route options (typically one for walking).
Error responses
| Status | Body | Cause |
|---|---|---|
400 | { "error": "Faltan coordenadas" } | originCoords or destinationCoords missing from the request body. |
401 | — | No or invalid Bearer token. |
500 | { "error": "No se pudo calcular la ruta" } | The Google Routes API returned an error. |
