Skip to content

🚂 Portuguese public transportation data from GTFS to a rest API.

License

Notifications You must be signed in to change notification settings

AndreVarandas/transportes-portugal-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transportes Portugal API 🚂

semantic-release

All the available data about the major public transportation providers of Portugal from GTFS (General Transit Feed Specification) to a rest API.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

The project will not work without the following prerequisites:

Optional

  • Postman - The api only accepts post requests, postman is a good tool to test api's.

Installing

Install with

npm install

Start the development server

npm run dev

Important

By default, importing data is disabled by the env variable SKIP_IMPORT=true.

On your very first run, you may want to remove this variable, in order to get some data.

Try it out

Go to http://localhost:3000 to check that the app is running.

Open Postman and send an empty POST to http://localhost:3000/api/v1/agencies to get all the available providers.

Deployment

Build a production ready package with

npm run build

And start the production package with

npm start

Current Agencies

  • Comboios de Portugal - agency_key: 'cp'
  • Metro de Lisboa - agency_key: 'metro-lisboa'
  • Carris - agency_key: 'carris'
  • Fertagus- agency_key: 'fertagus'
  • Soflusa - agency_key: 'soflusa'
  • Sulfertagus - agency_key: 'sulfertagus'
  • Transtejo - agency_key: 'transtejo'
  • Rodoviária de Lisboa - agency_key: 'rodoviaria-de-lisboa'
  • Transportes Sul do Tejo - agency_key: 'tst'
  • STCP - Sociedade de Transportes Colectivos do Porto - agency_key: 'stcp'
  • Metro do Porto - agency_key: 'metro-porto'

Examples

Querying for an agency POST /agencies

// Get one agency by agency key
fetch('http://localhost:3000/api/v1/agencies', {
	method: 'POST',
	headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    },
	body: JSON.stringify({ 
	    query: { agency_key: 'metro-lisboa' } 
	})
})
    .then(res => res.json())
    .then(resp => console.log(resp))
    
// Will log details about the agency.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

🚂 Portuguese public transportation data from GTFS to a rest API.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •