public-transport / hafas-client-health-check

Check if a hafas-client instance and its endpoint work.

Home Page:https://github.com/public-transport/hafas-client-health-check#hafas-client-health-check

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hafas-client-health-check

A heuristic to check if a hafas-client@5/hafas-client@6 instance and the underlying HAFAS endpoint work. It will query departures at a well-known station for the coming Monday 8am.

npm version ISC-licensed support me via GitHub Sponsors chat with me on Twitter

Installation

npm install hafas-client-health-check

Usage

const createHafasClient = require('hafas-client')
const dbProfile = require('hafas-client/p/db')
const createHealthCheck = require('hafas-client-health-check')

const hafasClient = createHafasClient(dbProfile, 'my-awesome-program')
const berlinHbf = '8011160'
const checkIfHealthy = createHealthCheck(hafasClient, berlinHbf)

checkIfHealthy()
.then((isHealthy) => {
	if (isHealthy) console.error('hafas-client instance is healthy.')
	else console.error('hafas-client instance is not healthy!')
})
.catch((err) => { // something exceptional happend
	console.error(err)
	process.exitCode = 1
})

Contributing

If you have a question or need support using hafas-client-health-check, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.

About

Check if a hafas-client instance and its endpoint work.

https://github.com/public-transport/hafas-client-health-check#hafas-client-health-check

License:ISC License


Languages

Language:JavaScript 100.0%