Skip to main content

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.

Two endpoints power the map view in AirGuide. 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 GeoJSON FeatureCollection 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

type
string
Always "FeatureCollection".
features
object[]
Array of GeoJSON Feature objects. Contains both building point features and path line features.

Example

curl http://localhost:3001/api/mapa/data
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "name": "Edificio A",
        "type": "building",
        "id": 1,
        "descripcion": "Edificio de ingeniería y sistemas"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [-99.1332, 19.4326]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "type": "footway",
        "id": 5
      },
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [-99.1331, 19.4325],
          [-99.1330, 19.4327]
        ]
      }
    }
  ]
}

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

Authorization
string
required
Bearer token for any authenticated user: Bearer <token>.

Request body

originCoords
object
required
Starting point coordinates.
destinationCoords
object
required
Ending point coordinates.
routingPreference
string
default:"TRAFFIC_UNAWARE"
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:
routes
object[]
Array of computed route options (typically one for walking).

Error responses

StatusBodyCause
400{ "error": "Faltan coordenadas" }originCoords or destinationCoords missing from the request body.
401No or invalid Bearer token.
500{ "error": "No se pudo calcular la ruta" }The Google Routes API returned an error.

Example

curl --request POST \
  --url http://localhost:3001/api/google/compute-route \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "originCoords": { "latitude": 19.4326, "longitude": -99.1332 },
    "destinationCoords": { "latitude": 19.4341, "longitude": -99.1315 }
  }'
{
  "routes": [
    {
      "distanceMeters": 380,
      "duration": "284s",
      "polyline": {
        "encodedPolyline": "}_mnFnvq{Q..."
      }
    }
  ]
}

Build docs developers (and LLMs) love