german-transport-arrivals
v1.0.0
Published
A simple npm package that allows you to retrieve real-time arrival information for trains at a specific station in Germany.
Downloads
2
Readme
German Transport Arrivals
A simple npm package that allows you to retrieve real-time arrival information for trains at a specific station in Germany.
Installation
You can install the package using npm:
npm install german-transport-arrivals
Usage
const germanTransportArrivals = require('german-transport-arrivals');
germanTransportArrivals.getTrainArrivals('8000105')
.then(arrivals => console.log(arrivals))
.catch(error => console.error(error));
API
The package provides the following function:
getTrainArrivals(stationId)
Returns an array of train arrival objects for the specified station.
Parameters:
stationId
: The ID of the station you want to retrieve arrival data for. You can find station IDs on the Deutsche Bahn website.
Testing
You can test the package by creating a new file called test.js
in your project directory and adding the following code:
const germanTransportArrivals = require('./index');
germanTransportArrivals.getTrainArrivals('8000105')
.then(arrivals => console.log(arrivals))
.catch(error => console.error(error));
Replace 8000105
with the ID of the station you want to retrieve data for.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.