Route ground legs along real roads via an OSRM directions proxy

- GET /api/directions proxies OSRM (OSRM_URL env, default public demo
  server) with validation, Leaflet-order geometry, 24h capped cache
- Map draws straight lines first, then upgrades ground legs to
  road-following polylines with routed km (marked road) as directions
  arrive; silent fallback to great-circle on failure; air legs unchanged
- README documents OSRM_URL
This commit is contained in:
2026-07-20 10:54:04 +07:00
parent 65480fd892
commit 4cedab0cf6
7 changed files with 268 additions and 35 deletions
+2 -1
View File
@@ -109,10 +109,11 @@ npm test # API tests (node:test + supertest)
| `PORT` | `3000` | HTTP port the server listens on. |
| `DATA_DIR` | `./data` (`/app/data` in Docker) | Directory holding the SQLite database file. |
| `SESSION_SECRET` | dev value (warns) | Secret used to sign session cookies. **Set this in production.** |
| `OSRM_URL` | `https://router.project-osrm.org` | Base URL for the driving-directions proxy (`/api/directions`). The default is the public OSRM demo server — fine for light personal use. Self-hosters can point this at their own OSRM instance. |
## Data
All state lives in a single SQLite file under `DATA_DIR`. In Docker this is `/app/data`, bind-mounted from `./data` next to the compose file — back up that directory to back up all trips. No external database or services are required (geocoding calls OpenStreetMap's Nominatim, which needs no API key; airport lookups use a bundled offline dataset).
All state lives in a single SQLite file under `DATA_DIR`. In Docker this is `/app/data`, bind-mounted from `./data` next to the compose file — back up that directory to back up all trips. No external database or services are required (geocoding calls OpenStreetMap's Nominatim, which needs no API key; airport lookups use a bundled offline dataset; road directions call the public OSRM demo server, also no API key).
## Documentation