Washington Metropolitan Area Transit Authority API Node.JS Wrapper
This is a wrapper for the WMATA Web API that runs on Node.JS.
It includes helper functions to do the following:
Bus Information
- Bus positions
- Bus arrival time predictions
Train Information
- Train positions
- Train arrival time predictions
Dependencies
This project deponds on request to make HTTP requests.
Installation
$ npm install wmata-api-node --save
Usage
First, instantiate the wrapper.
var WmataApi = ; // Instantiate the api with your api keyvar wmataApi = 'mysupersecretkey123';
Use the wrapper's methods to make requests to WMATA's web API. Methods use promises, so be sure to provide success and error handlers.
// Get bus positions for the D2 line wmataApi ;
Authorization
You must provide an API key to the wrapper at instantiation. See WMATA's API documentation for steps on obtaining your free API key.
Development
Discover a bug, or have improvements? Open an issue or clone the project and send a pull request with your changes!
Running tests
You can run unit tests by executing mocha
.