Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mi11y/next

Repository files navigation

Next - A Transit API for PDX

Next is an API that provides transit related data from the Portland, OR area. Data comes from multiple sources including free-roaming scooters, free-roaming bikes, the metro area's transit system, and drive times.

Data Sources

This API obtains it's data from the following sources

Output

At a top level, the returned data from this API is structured like this:

{
  "bike_shares": { ... },
  "trimet_stops": { ... },
  "share_stations": { ... },
  "drive_times": [ ... ],
}

Setup and Run

  1. Install Docker and Docker compose. This app lives inside containers now.
  2. In order to start this API locally, first configure the following environment variables:
export $POSTGRES_USER= # Postgresql Databse Username
export $POSTGRES_PASSWORD= # Postgresql Password
export $POSTGRES_DB= # Postgresql Database Name
export $TRIMET_API_KEY= # Can be obtained from Trimet's Website
  1. To start for development, you can first run docker-compose -f docker-compose.dev.yml up -d to start all the services and the rails app itself. It may take some time for bundler to install the needed gems!

Run a docker-compose ps to see them running:

NAME                COMMAND                  SERVICE             STATUS              PORTS
next_postgres_1     "docker-entrypoint.s…"   postgres            running             0.0.0.0:5432->5432/tcp, :::5432->5432/tcp
next_redis_1        "docker-entrypoint.s…"   redis               running             0.0.0.0:6379->6379/tcp, :::6379->6379/tcp
next_web_1          "entrypoint.sh bash …"   web                 running             0.0.0.0:3000->3000/tcp, :::3000->3000/tcp
  1. Bash into the running next_web_1 container with ./bash_into_next.sh or by running docker exec -it next_web_1 bash.
  2. Once inside the container, cd /src/ and start the rails app and the sidekiq jobs with foreman start.

Thats it! The src/ director is mounted as a volume inside the container, so you can make edits to the source and see them affect the API immediately!

Setup and Run Tests

Follow steps 1 through 4 from above, and then: 3. Run rspec inside the src/ directory and watch the output!

About

An API that provides transit data for the PDX area.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published