Displays approaching buses and trains using the Chicago Transit Authority APIs. The bus and train APIs are slightly different and each require their own key.
This project has been tested on Amazon Web Services. There is an amplify.yml
deployment file built in for easy hosting on Amplify. In addition to the Amplify build script there are serverless Lambda functions in the /lambda
folder, deploy these to your cloud accound and set them up with configuration settings below.
This PDF is the official documentation for the bus API. You can request an API key by registering on the transitchicago.com site, they directly email the keys and the process can take 1-2 weeks from the time you request it.
Type | Name | Description |
---|---|---|
Environment | CTA_BUS_KEY | API key from the CTA. |
GET | route | Route ID. Use the bus tracker site to select your stop and pull the route identifier out of the URL ("route"). |
GET | stops | Stop(s). Multiple stops are comma separated Use the bus tracker site to select your stops and pull the stop identifier out of the URL ("id"). |
Gatsby expects some configuration settings in the .env.development
and .env.production
files. There is an example template file for the configuration named example.env.production
in the gatsby
folder.
Type | Name | Description |
---|---|---|
Environment | GATSBY_LAMBDA_EP_BUSES | AWS Lambda endpoint to send the request for updated bus info. |
Environment | GATSBY_LAMBDA_EP_TRAINS | AWS Lambda endpoint to send the request for updated train info. |
Environment | GATSBY_REQUEST_REFRESH_DELAY | Delay in MS for refreshing data from the APIs, defaults to 15 seconds. |
Environment | GATSBY_BUS_STOPS | JSON object containing a list of bus stops to query. Reference the example file for structure. |