NextBus Inc. has been providing real-time passenger information about transit agencies through their public XML feed for years. The data provided has always been top notch, especially for building real-time web applications, but in my opinion the service has three glaring shortcomings:
- It ignores useful HTTP status codes. Every response is an HTTP 200 (even errors).
- It's focused around commands and query parameters to act on resources instead of being RESTful.
application/jsonmedia type is not supported.
After installing with
npm install restbus, you can start the restbus server in a couple different ways:
Now your application can access the NextBus XML feed via a RESTful JSON API running at
http://localhost:3535. Check out a full demo to see some of the sample responses.