REST API to request GTFS data from postgres database
Go to file
dancingCycle 9881e8da62 chore: bump version to v0.22.1 2024-01-31 15:19:43 +01:00
doc doc: refactor doc/deployment-with-pm2.md 2023-11-07 23:06:39 +01:00
etc/apache2/sites-available feat: add example virtual host conf file for apache2 proxy 2022-05-06 15:19:51 +02:00
src fix: adjust schema for route trip-updates-odd-routes and trip-updates-odd-trips 2024-01-31 15:19:05 +01:00
.gitignore chore: add package-lock.json 2022-07-07 21:17:58 +02:00
LICENSE Initial commit 2022-05-02 20:36:22 +02:00
index.js refactor: mv app src 2023-12-21 07:22:40 +01:00
package-lock.json chore: bump version to v0.22.1 2024-01-31 15:19:43 +01:00
package.json chore: bump version to v0.22.1 2024-01-31 15:19:43 +01:00
readme.md feat: ORDER BY agency_id or route_short_name or trip_short_name (sth static) 2024-01-30 07:37:26 +01:00

readme.md

Postgres-gtfs-rest-api

REST API to request GTFS data from postgres database

Table of Contents

  1. General
  2. Quick Start Guide
  3. Setup
  4. SQL Statemants
  5. Links

General

Requirements:

Quick Start Guide

Preparation

  • check out project and change into root folder
git clone git@github.com:Software-Ingenieur-Begerad/postgres-gtfs-rest-api.git
  • run the following instruction to install dependenies.
npm i

Development setup

  • run the following instruction to start the service in development mode
DEBUG=debug,trip-count-day-agency,trip-count-day-route,table-calendar-dates-count,table-agency-count,table-routes-count,table-shapes-count,table-trips-count,table-calendar-count,table-frequencies-count,table-levels-count,table-names,table-count,trip-count,service-overview,gtfs,date,servicedays,service,agency-url,agency-name,route-short-name,trip-headsign,routes,frequencies,stops,index,root npm run dev

Production setup

  • run the following instruction to start the service in production mode
npm run start

SQL Statemants

  • get a certain service by service_id
select * from calendar where service_id='675';
  • get all trips that belong to a route
select agency.agency_name, routes.route_short_name, routes.agency_id, trips.route_id, trips.service_id, trips.trip_id from agency, trips, routes where agency.agency_id=routes.agency_id and trips.route_id=routes.route_id and routes.route_short_name='411';
  • get all routes from agency
select route_short_name from routes,agency where routes.agency_id=agency.agency_id and agency.agency_id='381';
  • get trip direction from trip number
select trip_headsign from trips where trip_short_name='1226016';
  • get route number from trip number
select routes.route_short_name from routes, trips where trips.trip_short_name='1226015' AND routes.route_id=trips.route_id;
  • get agency name from route number
select agency.agency_name from agency,routes where routes.route_id='47189' AND routes.agency_id=agency.agency_id;
  • get agency URL from route number
select agency.agency_url from agency,routes where routes.route_id='47189' AND routes.agency_id=agency.agency_id;
  • other
select route_id,trip_headsign from trips where trip_short_name='1226016';
select * from routes where route_id='47189';
select * from agency where agency_id='121';select route_id, agency_id, route_short_name from routes where route_id='61625';
select trips.route_id, agency.agency_id, agency.agency_name, route_short_name, service_id, trip_id, trip_headsign, trip_short_name from agency, routes, trips where trips.route_id='61625' AND trip_short_name='4450024' AND agency.agency_id='143' AND route_short_name='450';
select trips.route_id, routes.agency_id, route_short_name, service_id, trip_id, trip_headsign, trip_short_name from routes, trips where trips.route_id='61625' AND routes.agency_id='143' AND route_short_name='450';

Link