@motis-project/motis-fptf-client

6.0.1 • Public • Published

motis-fptf-client

A client for MOTIS that is a drop-in replacement for hafas-client and/or db-vendo-client, in short, everything that is more or less compatible with the Friendly Public Transport Format (FPTF).

npm version ISC-licensed

This is an early version. The following FPTF/hafas-client endpoints are supported:

  • journeys()
  • locations(),
  • departures(), arrivals() boards
  • reachableFrom()

What doesn't work (yet):

  • refreshJourney()
  • nearby()
  • trip()
  • all other endpoints (tripsByName(), radar(), journeysFromTrip(), remarks(), lines(), station(), stop())

By default, a transitous profile is included, but you can use it with any other MOTIS instance.

Background

This project exists to ease transitioning from HAFAS-based APIs to open APIs run with open schedule/RT data. It uses motis-client to access the MOTIS API, use that if you want to access the full capabilities and features of MOTIS, use motis-fptf-client only when you want to replace/run in parallel with hafas-client and/or db-vendo-client.

Usage

Use it as a dependency, e.g. just replacing hafas-client:

npm i motis-fptf-client

See an example in api.js. It shows how you can use motis-fptf-client together with hafas-rest-api and some hacks in order to run a FPTF API server:

docker run \
    -e USER_AGENT=my-awesome-program \
    -p 3000:3000 \
    ghcr.io/public-transport/motis-fptf-client

There are community-maintained TypeScript typings available as @types/hafas-client.

Browser usage

motis-fptf-client should be mostly browser compatible. Limitations: Does not work with enrichStations option enabled.

Related Projects

Contributing

If you have a question, found a bug or want to propose a feature, please open an Issue.

This project needs help! Check the list of "help wanted" Issues.

If you're contributing code, please read the contribution guidelines.

Package Sidebar

Install

npm i @motis-project/motis-fptf-client

Weekly Downloads

5

Version

6.0.1

License

ISC

Unpacked Size

67 kB

Total Files

48

Last publish

Collaborators

  • felixguendling
  • pablohoch
  • traines-source