https://github.com/eduardoportilho/trafikverket
🚂 A wrapper for the Trafikverket API which provides information about trains in Sweden.
https://github.com/eduardoportilho/trafikverket
Last synced: 5 months ago
JSON representation
🚂 A wrapper for the Trafikverket API which provides information about trains in Sweden.
- Host: GitHub
- URL: https://github.com/eduardoportilho/trafikverket
- Owner: eduardoportilho
- License: mit
- Created: 2017-02-03T06:26:47.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-11T08:06:14.000Z (over 7 years ago)
- Last Synced: 2024-10-11T01:08:34.366Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 84 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-sweden - JavaScript
README
# Trafikverket Wrapper
[](https://travis-ci.org/eduardoportilho/trafikverket)
[](https://codecov.io/github/eduardoportilho/trafikverket)
[](http://npm.im/trafikverket)
[](http://opensource.org/licenses/MIT)
[](https://github.com/semantic-release/semantic-release)[](https://nodei.co/npm/trafikverket/)
A wrapper for the [Trafikverket API](http://api.trafikinfo.trafikverket.se/API/) that provides information about trains in Sweden.
## Usage
```javascript
let trafikverket = require('trafikverket')
trafikverket.getDepartures('Cst', 'Flen')
```## FAQ
* How do I set my API key in my host?
```
export TRAFIKVERKET_API_KEY=
```* How do I test the api?
```
$ npm run build
$ cd dist
$ env TRAFIKVERKET_API_KEY= NODE_ENV=production node
> let trafik = require('./index')
> trafik.getDepartures('Fle').then((obj) => console.log(JSON.stringify(obj, null, 2)))
```## Roadmap:
- [x] `trafik.getDepartures('Cst', 'Fle')` (When 'Fle' is not the final destination)
- [x] Create service to return station info (sync?)
- [x] Parametrize the time interval
- [ ] Filter anouncements without data