Compare commits
No commits in common. "6" and "6.0.2" have entirely different histories.
9 changed files with 725 additions and 1551 deletions
5
.github/renovate.json
vendored
5
.github/renovate.json
vendored
|
@ -9,5 +9,8 @@
|
|||
"automerge": true,
|
||||
"automergeType": "branch",
|
||||
"ignoreTests": true
|
||||
}
|
||||
},
|
||||
"schedule": [
|
||||
"before 4am on tuesday"
|
||||
]
|
||||
}
|
||||
|
|
29
.github/workflows/docker-image.yml
vendored
29
.github/workflows/docker-image.yml
vendored
|
@ -6,7 +6,18 @@ on:
|
|||
jobs:
|
||||
lint-test:
|
||||
name: lint, build & test
|
||||
uses: './.github/workflows/lint-test.yml'
|
||||
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
|
||||
|
||||
build-and-publish:
|
||||
name: build & publish Docker image
|
||||
|
@ -14,13 +25,11 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check out the repo
|
||||
uses: actions/checkout@v4
|
||||
- name: set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
uses: actions/checkout@v3
|
||||
- name: configure Docker to use buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
||||
|
@ -29,7 +38,6 @@ jobs:
|
|||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: |
|
||||
derhuerst/db-rest:6
|
||||
derhuerst/db-rest:latest
|
||||
|
@ -39,7 +47,7 @@ jobs:
|
|||
|
||||
# this is for the public-transport/infrastructure cluster
|
||||
- name: log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
|
@ -55,10 +63,7 @@ jobs:
|
|||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: |
|
||||
ghcr.io/${{github.repository}}:v6
|
||||
ghcr.io/${{github.repository}}:v6_${{steps.hash.outputs.hash}}_${{steps.datetime.outputs.datetime}}
|
||||
tags: ghcr.io/${{github.repository}}:v6_${{steps.hash.outputs.hash}}_${{steps.datetime.outputs.datetime}}
|
||||
# https://docs.docker.com/build/ci/github-actions/examples/#github-cache
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max,oci-mediatypes=true,compression=zstd
|
||||
|
|
35
.github/workflows/lint-test.yml
vendored
35
.github/workflows/lint-test.yml
vendored
|
@ -1,35 +0,0 @@
|
|||
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
|
|
@ -61,7 +61,7 @@ Uses [\`hafasClient.journeys()\`](https://github.com/public-transport/hafas-clie
|
|||
\`from\` (A), \`to\` (B), and the optional \`via\` must each have one of these formats:
|
||||
|
||||
- as stop/station ID (e.g. \`from=8010159\` for *Halle (Saale) Hbf*)
|
||||
- as a POI (e.g. \`from.id=991561765&from.latitude=51.48364&from.longitude=11.98084&from.name=Halle+(Saale),+Stadtpark+Halle+(Grünanlagen)\` for *Halle (Saale), Stadtpark Halle (Grünanlagen)*)
|
||||
- as a POI (e.g. \`from.id=991561765&from.latitude=51.48364&from.longitude=11.98084\` for *Halle+(Saale),+Stadtpark+Halle+(Grünanlagen)*)
|
||||
- as an address (e.g. \`from.latitude=51.25639&from.longitude=7.46685&from.address=Hansestadt+Breckerfeld,+Hansering+3\` for *Hansestadt Breckerfeld, Hansering 3*)
|
||||
|
||||
### Pagination
|
||||
|
|
|
@ -4,21 +4,17 @@
|
|||
|
||||
[](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**.
|
||||
|
||||
*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.*
|
||||
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**.
|
||||
|
||||
- [Getting Started](getting-started.md)
|
||||
- [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)
|
||||
- [API documentation](api.md)
|
||||
- [OpenAPI playground](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 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.*
|
||||
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.
|
||||
|
||||
### No API Key
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2024, Jannis R
|
||||
Copyright (c) 2022, Jannis R
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
|
|
2166
package-lock.json
generated
2166
package-lock.json
generated
File diff suppressed because it is too large
Load diff
16
package.json
16
package.json
|
@ -2,19 +2,9 @@
|
|||
"private": true,
|
||||
"name": "db-rest",
|
||||
"description": "A clean REST API wrapping around the Deutsche Bahn API.",
|
||||
"version": "6.0.5",
|
||||
"version": "6.0.2",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"db-rest": "./index.js"
|
||||
},
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"docs",
|
||||
"lib",
|
||||
"routes",
|
||||
"api.js",
|
||||
"index.js"
|
||||
],
|
||||
"author": "Jannis R <mail@jannisr.de>",
|
||||
"homepage": "https://github.com/derhuerst/db-rest/tree/6",
|
||||
"repository": "derhuerst/db-rest",
|
||||
|
@ -47,12 +37,12 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@derhuerst/technical-docs-cli": "^1.5.0",
|
||||
"axios": "^1.6.1",
|
||||
"axios": "~1.1",
|
||||
"eslint": "^8.12.0",
|
||||
"get-port": "^6.1.2",
|
||||
"ndjson": "^2.0.0",
|
||||
"pino-pretty": "^9.1.1",
|
||||
"tap-min": "^3.0.0",
|
||||
"tap-min": "^2.0.0",
|
||||
"tape": "^5.5.2"
|
||||
},
|
||||
"scripts": {
|
||||
|
|
|
@ -15,16 +15,14 @@
|
|||
|
||||
## installing & running
|
||||
|
||||
### 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).
|
||||
`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.
|
||||
|
||||
### via Docker
|
||||
|
||||
A Docker image [is available as `docker.io/derhuerst/db-rest:6`](https://hub.docker.com/r/docker.io/derhuerst/db-rest:6).
|
||||
A Docker image [is available as `derhuerst/db-rest:6`](https://hub.docker.com/r/derhuerst/db-rest:6).
|
||||
|
||||
```shell
|
||||
docker run -d -p 3000:3000 docker.io/derhuerst/db-rest:6
|
||||
docker run -d -p 3000:3000 derhuerst/db-rest:6
|
||||
```
|
||||
|
||||
*Note:* The Docker image does not contain the Redis server.
|
||||
|
@ -49,7 +47,6 @@ To keep the API running permanently, use tools like [`forever`](https://github.c
|
|||
|
||||
## Related Projects
|
||||
|
||||
- [`DB-Adapter-v6`](https://github.com/olech2412/DB-Adapter-v6) – A Java API client for `db-rest`.
|
||||
- [`vbb-rest`](https://github.com/derhuerst/vbb-rest) – A clean REST API wrapping around the VBB API.
|
||||
- [`bvg-rest`](https://github.com/derhuerst/bvg-rest) – A clean REST API wrapping around the BVG API.
|
||||
- [`hvv-rest`](https://github.com/derhuerst/hvv-rest) – A clean REST API wrapping around the HVV API.
|
||||
|
|
Loading…
Add table
Reference in a new issue