Skip to content

Latest commit

 

History

History
44 lines (28 loc) · 2.08 KB

readme.md

File metadata and controls

44 lines (28 loc) · 2.08 KB

hafas-gtfs-rt-server-example

Expose a HAFAS endpoint as a GTFS Realtime (GTFS-RT) server.

ISC-licensed chat with me on Gitter support me via GitHub Sponsors

This is an example project that demonstrates how to

  1. use hafas-client & hafas-monitor-trips to fetch live data about all vehicles in a bounding box,
  2. use hafas-gtfs-rt-feed & gtfs-rt-differential-to-full-dataset to build a live GTFS Realtime (GTFS-RT) feed from the data,
  3. use serve-buffer to serve the feed efficiently.

Installing & running

hafas-gtfs-rt-server-example expects a Redis server running on 127.0.0.1:6379 (default port), but you can set the REDIS_URL environment variable to change this.

Specify the bounding box to be observed as JSON:

BBOX='{"north": 52.52, "west": 13.36, "south": 52.5, "east": 13.39}'

via Docker

A Docker image is available as derhuerst/hafas-gtfs-rt-server-example.

docker run -d -p 3000:3000 -e BBOX='' derhuerst/hafas-gtfs-rt-server-example

Note: The Docker image does not contain the Redis server.

manually

git clone https://github.com/derhuerst/hafas-gtfs-rt-server-example.git
cd hafas-gtfs-rt-server-example
npm install --production

env BBOX='' node index.js