A Node.js wrapper for the Bike Share Toronto API (Open Data Toronto).
-
Install via npm.
npm i -S bikeshare
-
Or install directly from source.
git clone https://github.com/kshvmdn/bikeshare.git
bikeshare.getStations
-
Retrieve list of all stations.
-
Supports both Promises and error-first callbacks, use whichever you prefer. 😄
const bikeshare = require('bikeshare'); bikeshare.getStations((err, res) => { if (err) throw err console.log(res) }) const request = bikeshare.getStations() request .then((res) => console.log(res)) .catch((err) => console.error(err))
-
Sample response
{ "meta": { "updated": "2016-08-07T23:11:42.000Z", "count": { "active": 200, "total": 200 } }, "stations": [ { "id": 7000, "stationName": "Ft. York / Capreol Crt.", "availableDocks": 12, "totalDocks": 31, "latitude": 43.639832, "longitude": -79.395954, "statusValue": "In Service", "statusKey": 1, "status": "IN_SERVICE", "availableBikes": 18, "stAddress1": "Ft. York / Capreol Crt.", "stAddress2": null, "city": "Toronto", "postalCode": null, "location": null, "altitude": null, "testStation": false, "lastCommunicationTime": "2016-08-07T23:09:38.000Z", "landMark": null, "is_renting": true }, ... ] }
The project is completely open source. Feel free to open an issue or submit a PR.