arbeuerman / next-trip_target

Using Minneapolis NexTrip API to get bus routes, directions and stops

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Next Trip Case Study

Description

This case study attempts to emulate some portions of the NexTrip API, used in Minneapolis for their bus and train routes. The documentation and examples for using the API can be found here.

The following routes were used from the API:

  • to load routes: GET '/nextripv2/routes'
  • to load directions: GET '/nextripv2/directions/{route_id}
  • to load stops: GET '/nextripv2/stops/{route_id}/{direction_id}

Building and running app

To run the app

  1. Clone the repository
  2. Navigate to folder next-trip_target
  3. Run npm ci in terminal to ensure npm packages up-to-date
  4. Enter command npm start in terminal to spin up localhost

To execute tests

  1. Open a new terminal window
  2. Run npm test to run tests
  3. Might have to enter a to run all tests

Assumptions

  • User would want stops displayed when route is changed (they are not cleared right now when route changes, but they are updated).
  • API calls might be made in more than one file, so put all calls into one api file for ease of use.
  • Each file responsible for own needed inputs i.e. route_id, direction_id, instead of having a parent file that managed those parameters, passed route_id down as props twice. Might want to consider having a parent component hold that as state if there were multiple children that needed it.
  • Axios not needed for now, instead just using the built-in fetch for calling the API. If calls got more complex or if we wanted to not mock the global fetch function for testing, we might want to switch to using axios.
  • Nesting of components is: App --> RouteSelector --> DirectionSelector --> Stops but if we wanted to display stops via another path (for example, on the nexTrip site you can also search by stop number) we might want to nest in a different way.
  • When user goes back and forth between home page and selecting a route, the data is reset. Potentially we would want to maintain that data when the user goes between these pages.

About

Using Minneapolis NexTrip API to get bus routes, directions and stops


Languages

Language:JavaScript 80.2%Language:HTML 12.8%Language:CSS 7.1%