update readme

This commit is contained in:
Traines 2025-01-08 18:35:13 +00:00
parent d992961421
commit 8026689ee8
2 changed files with 12 additions and 2 deletions

2
api.js
View file

@ -46,7 +46,7 @@ const config = {
const start = async () => {
const vendo = createClient(dbProfile, 'my-hafas-rest-api', config);
const vendo = createClient(dbProfile, process.env.USER_AGENT || process.env.HOSTNAME || 'link-to-your-project-or-email', config);
const api = await createApi(vendo, config);
api.listen(config.port, (err) => {

View file

@ -48,7 +48,17 @@ Strictly speaking, permission is necessary to use this library with the DB APIs.
## Usage
See an example in [api.js](api.js). It shows how you can use `db-vendo-client` together with `hafas-rest-api` in order to run a [FPTF](https://github.com/public-transport/friendly-public-transport-format) API server. The [Dockerfile](Dockerfile) serves this API.
Use it as a dependency, e.g. just replacing [hafas-client](https://github.com/public-transport/hafas-client/):
```
npm i db-vendo-client
```
See an example in [api.js](api.js). It shows how you can use `db-vendo-client` together with `hafas-rest-api` in order to run a [FPTF](https://github.com/public-transport/friendly-public-transport-format) API server. The [Dockerfile](Dockerfile) serves this API:
```
docker run -e USER_AGENT=my-awesome-program -p 3000:3000 ghcr.io/public-transport/db-vendo-client
```
There are [community-maintained TypeScript typings available as `@types/hafas-client`](https://www.npmjs.com/package/@types/hafas-client).