A case study exploring the Metro Transit NexTrip API
To make successful fetch requests to the Metro Transit API, this application is best run in Google Chrome with the CORS Unblock extension activated.
To run, simply clone the app into a directory of your choice, install the dependencies and devDependencies and start the server, and navigate to http://localhost:8000/dist/index.html.
git clone https://github.com/josephAnda/nextrip-app.git
cd nextrip-app
npm i && npm run build-dev && npm run start
To execute the unit testing suite ...
npm i && npm run test
To evaluate code coverage, use the following script:
npm run test:coverage
Or to run jest directly . . .
npm i jest --global
jest
In this application, we make a few assumptions about what a production version may look like, namely:
- API/services will be accessed via same-orign requests (https://)
- User input that alters a route or direction will clear/reset any shown stops
- HTTP requests for a given set of stops will need to be routed to separate page(s) to enable forward/back browser navigation that accurately reflects query history. For example, the
StopsDisplay
component can be treated as a link in which the bus routes and directions are processed before redirecting the user to a seprate page with the output (stops on the route in order)