{"id":22093203,"url":"https://github.com/iadvize/health-check-library","last_synced_at":"2025-07-24T20:32:39.526Z","repository":{"id":30386279,"uuid":"33938941","full_name":"iadvize/health-check-library","owner":"iadvize","description":"Expose an health-check API to *-worker or a health-check route for already existing API","archived":false,"fork":false,"pushed_at":"2022-03-04T12:20:58.000Z","size":120,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":50,"default_branch":"master","last_synced_at":"2024-11-11T21:54:46.466Z","etag":null,"topics":["hapi","healtcheck","http","nodejs"],"latest_commit_sha":null,"homepage":"http://bit.ly/1LJEDcE","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iadvize.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2015-04-14T15:06:41.000Z","updated_at":"2023-03-31T13:39:37.000Z","dependencies_parsed_at":"2022-08-25T04:21:00.062Z","dependency_job_id":null,"html_url":"https://github.com/iadvize/health-check-library","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fhealth-check-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fhealth-check-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fhealth-check-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fhealth-check-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iadvize","download_url":"https://codeload.github.com/iadvize/health-check-library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227476013,"owners_count":17779417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hapi","healtcheck","http","nodejs"],"created_at":"2024-12-01T03:13:16.460Z","updated_at":"2024-12-01T03:13:17.248Z","avatar_url":"https://github.com/iadvize.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"health-check-library [![CircleCI](https://circleci.com/gh/iadvize/health-check-library.svg?style=svg)](https://circleci.com/gh/iadvize/health-check-library) [![Deps](https://david-dm.org/iadvize/health-check-library.png)](https://david-dm.org/iadvize/health-check-library) [![Version](http://badge.fury.io/js/health-check-library.png)](https://david-dm.org/iadvize/health-check-library)\n====================\n\n\u003e Expose an health-check API to *-worker or a health-check route for already existing API\n\n**Kubernetes** (Google Container Engine, Clever-cloud and so on...) requires every processes to expose an HTTP API [so it can ensure the service is up](https://github.com/GoogleCloudPlatform/kubernetes/blob/06a1d6dd839a7169270ed09a1829381696fcca45/pkg/probe/http/http.go#L53-56).\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://cloud.githubusercontent.com/assets/138050/7140277/be87ed10-e2ca-11e4-96ec-b6e086321bac.gif\" style=\"width:1000%\" /\u003e\n\u003c/p\u003e\n\nInstead of duplicating code everywhere in the code, the `health-check-library` simply expose a route in a language-agnostic and unified way.\n\nfeatures :\n* Language agnostic, if it's not supported in your current language **simply send a PR that follows the above conventions**\n* Framework agnostic, if the framework you use is not supported **simply send a PR that follows the above conventions**\n\n## Examples\n\n### JavaScript / pure (without an existing HTTP API)\n\nUse this when your NodeJS process (a.k.a worker) does not currently expose an HTTP API.\n\n```\n// Usage\nrequire('health-check-library')(port [, callback]);\n```\n\nIf `health-check-library` was not able to bind to the specified port it will throw an error and make the worker crash (that's [a good thing](http://en.wikipedia.org/wiki/Fail-fast)).\n\n```\nvar healthy = require('health-check-library/javascript/pure')(8080, function onListening(){\n\n    // do some initializations\n    healthy(true); // you are ready\n});\n```\n\n### JavaScript / hapi\n\nUse this when your NodeJS process already exposes an HTTP API with HAPI. Please note that HAPI should always* be used in NodeJS, don't forget to document your API with [swaggerize-hapi](https://github.com/krakenjs/swaggerize-hapi).\n\nIf `health-check-library` was not able to register itself to the HAPI server it will throw an error and will make the process crash (that's [a good thing](http://en.wikipedia.org/wiki/Fail-fast)).\n\n```\nvar healthy = require('health-check-library').register(server);\n\n// by default GET /_health will yield a 500 error\n\nhealthy(true);\n\n// now GET /_health yield an 200 success\n```\n\n* always = 99.9% of the time\n\n## Install\n\n### Install through npm\n\n```bash\nnpm install health-check-library --save\n```\n\n## Documentation\n\n### Specification\n\n`health-check-library` **MUST** expose a **GET /_health** route that yield a **200 HTTP status code**.\n`health-check-library` follows [semver](http://semver.org) so any non-backward-compatible change will be a major release.\n\n## Contribute\n\nLook at contribution guidelines here : [CONTRIBUTING.md](CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiadvize%2Fhealth-check-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiadvize%2Fhealth-check-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiadvize%2Fhealth-check-library/lists"}