Compare commits
17 commits
Author | SHA1 | Date | |
---|---|---|---|
|
f0901ed56c | ||
|
cf63dff36b | ||
|
be8aee3fbf | ||
|
58c18827ca | ||
|
5fffdb88d2 | ||
|
4517d41e2b | ||
|
0d92cb7ed0 | ||
|
3e5dc8e733 | ||
|
4be921d5dd | ||
|
399713695e | ||
|
66ca7d32e5 | ||
|
76358235ab | ||
|
6a94c19dc8 | ||
|
291006c81e | ||
|
3941e5f4ea | ||
|
e8b040e601 | ||
|
d53ff22d53 |
6 changed files with 1290 additions and 591 deletions
21
.github/workflows/docker-image.yml
vendored
21
.github/workflows/docker-image.yml
vendored
|
@ -6,18 +6,7 @@ on:
|
|||
jobs:
|
||||
lint-test:
|
||||
name: lint, build & test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.x
|
||||
- run: npm ci
|
||||
- run: npm run lint
|
||||
- run: npm run build
|
||||
- run: npm test
|
||||
uses: './.github/workflows/lint-test.yml'
|
||||
|
||||
build-and-publish:
|
||||
name: build & publish Docker image
|
||||
|
@ -25,13 +14,13 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check out the repo
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: configure Docker to use buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: log in to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
||||
|
@ -50,7 +39,7 @@ jobs:
|
|||
|
||||
# this is for the public-transport/infrastructure cluster
|
||||
- name: log in to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
|
|
35
.github/workflows/lint-test.yml
vendored
Normal file
35
.github/workflows/lint-test.yml
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
name: lint, build & test
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
lint-test:
|
||||
name: lint, build & test
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version:
|
||||
- '16.x'
|
||||
- '18.x'
|
||||
- '20.x'
|
||||
- '22.x'
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- run: npm ci
|
||||
|
||||
- run: npm run lint
|
||||
- run: npm run build
|
||||
- run: npm test
|
|
@ -4,17 +4,21 @@
|
|||
|
||||
[](https://stats.uptimerobot.com/57wNLs39M/793274556)
|
||||
|
||||
Because it wraps [an API](https://github.com/public-transport/hafas-client/blob/6/readme.md#background) of [Deutsche Bahn](https://de.wikipedia.org/wiki/Deutsche_Bahn), it **includes most of the long-distance and regional traffic, as well as some international trains and local buses**. Essentially, it returns whatever data the [*DB Navigator* app](https://www.bahn.de/p/view/service/mobile/db-navigator.shtml) shows, **including realtime delays and disruptions**.
|
||||
Because it wraps [an API](https://github.com/public-transport/hafas-client/blob/6/readme.md#background) of [Deutsche Bahn](https://de.wikipedia.org/wiki/Deutsche_Bahn), it **includes most of the long-distance and regional traffic, as well as some international trains and local buses**. Essentially, it returns whatever data the [*DB Navigator* app](https://www.bahn.de/p/view/service/mobile/db-navigator.shtml) shows*, **including realtime delays and disruptions**.
|
||||
|
||||
*When comparing results from this API to what the DB Navigator app shows there might be occasional differences due to them utilizing different, not 100% identical backends.*
|
||||
|
||||
- [Getting Started](getting-started.md)
|
||||
- [API documentation](api.md)
|
||||
- [OpenAPI playground](https://petstore.swagger.io/?url=https%3A%2F%2Fv6.db.transport.rest%2F.well-known%2Fservice-desc%0A)
|
||||
- [API documentation](api.md) (run `npm run build` to generate)
|
||||
- [OpenAPI playground with API documentation](https://petstore.swagger.io/?url=https%3A%2F%2Fv6.db.transport.rest%2F.well-known%2Fservice-desc%0A)
|
||||
|
||||
## Why use this API?
|
||||
|
||||
### Realtime Data
|
||||
|
||||
This API returns realtime data whenever its upstream, the [API for DB's mobile app](https://github.com/public-transport/hafas-client/blob/6/p/db/readme.md), provides it.
|
||||
This API returns realtime data whenever it is upstream. The [API for DB's mobile app](https://github.com/public-transport/hafas-client/blob/6/p/db/readme.md) provides it.
|
||||
|
||||
*Note: Different endpoints might remove realtime data like delays and cancellations at different times, i.e. after a journey's arrival.*
|
||||
|
||||
### No API Key
|
||||
|
||||
|
|
1803
package-lock.json
generated
1803
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -2,7 +2,7 @@
|
|||
"private": true,
|
||||
"name": "db-rest",
|
||||
"description": "A clean REST API wrapping around the Deutsche Bahn API.",
|
||||
"version": "6.0.4",
|
||||
"version": "6.0.5",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"db-rest": "./index.js"
|
||||
|
|
|
@ -15,14 +15,16 @@
|
|||
|
||||
## installing & running
|
||||
|
||||
`db-rest` expects a [Redis](https://redis.io/) server running on `127.0.0.1:6379` (default port), but you can set the `REDIS_URL` environment variable to change this.
|
||||
### access to Redis
|
||||
|
||||
It is recommended that you let `bvg-rest` cache HAFAS responses within a [Redis](https://redis.io/) cache. To use this feature, set `$REDIS_URL` (e.g. to `redis://localhost:6379/1` when running Redis locally).
|
||||
|
||||
### via Docker
|
||||
|
||||
A Docker image [is available as `derhuerst/db-rest:6`](https://hub.docker.com/r/derhuerst/db-rest:6).
|
||||
A Docker image [is available as `docker.io/derhuerst/db-rest:6`](https://hub.docker.com/r/docker.io/derhuerst/db-rest:6).
|
||||
|
||||
```shell
|
||||
docker run -d -p 3000:3000 derhuerst/db-rest:6
|
||||
docker run -d -p 3000:3000 docker.io/derhuerst/db-rest:6
|
||||
```
|
||||
|
||||
*Note:* The Docker image does not contain the Redis server.
|
||||
|
|
Loading…
Add table
Reference in a new issue