The Mapbox service provides routing functionality for delivery orders. It fetches driving routes between two coordinates, decodes polyline geometry, and calculates delivery information including ETA and shipping costs.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Diego31-10/TableOrderApp/llms.txt
Use this file to discover all available pages before exploring further.
Functions
getDeliveryRoute
Fetches a driving route from origin (restaurant) to destination (customer) and returns structured delivery information.Restaurant coordinates in WGS-84 format
Customer delivery coordinates in WGS-84 format
Complete delivery route information
Example
Errors
Throws an error in the following cases:
EXPO_PUBLIC_MAPBOX_TOKENis not configured- Mapbox API returns a non-OK status
- No route found between the two points
calculateShippingCost
Calculates the shipping cost based on distance using the configured rate per kilometer.Distance in kilometers (typically from
DeliveryInfo.distanceKm)Shipping cost in currency units (rounded to 2 decimal places)
Example
Configuration
The service requires a Mapbox API token configured in the environment:Config.restaurant.costPerKm. Refer to SETUP2.md for complete configuration details.
API reference
This service uses the Mapbox Directions API v5:https://api.mapbox.com