From 8026689ee89c6a8eb9223a18155b0277b85c631b Mon Sep 17 00:00:00 2001 From: Traines Date: Wed, 8 Jan 2025 18:35:13 +0000 Subject: [PATCH] update readme --- api.js | 2 +- readme.md | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/api.js b/api.js index 827244fc..1fe90596 100644 --- a/api.js +++ b/api.js @@ -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) => { diff --git a/readme.md b/readme.md index 305b0e5e..5c4a55de 100644 --- a/readme.md +++ b/readme.md @@ -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).