Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 28 days 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 (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-11T08:06:14.000Z (about 7 years ago)
- Last Synced: 2024-10-11T01:08:34.366Z (2 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
[![travis build](https://img.shields.io/travis/eduardoportilho/trafikverket.svg?style=flat)](https://travis-ci.org/eduardoportilho/trafikverket)
[![codecov coverage](https://img.shields.io/codecov/c/github/eduardoportilho/trafikverket.svg?style=flat)](https://codecov.io/github/eduardoportilho/trafikverket)
[![version](https://img.shields.io/npm/v/trafikverket.svg?style=flat)](http://npm.im/trafikverket)
[![MIT License](https://img.shields.io/npm/l/trafikverket.svg?style=flat)](http://opensource.org/licenses/MIT)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat)](https://github.com/semantic-release/semantic-release)[![NPM](https://nodei.co/npm/trafikverket.png?downloads=true&stars=true)](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