{"id":24568743,"url":"https://github.com/lwhiteley/feathers-alive-ready","last_synced_at":"2025-03-17T05:27:18.984Z","repository":{"id":39453027,"uuid":"272287767","full_name":"lwhiteley/feathers-alive-ready","owner":"lwhiteley","description":"feathersjs health check endpoints","archived":false,"fork":false,"pushed_at":"2023-01-24T02:59:53.000Z","size":500,"stargazers_count":0,"open_issues_count":12,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T15:19:37.007Z","etag":null,"topics":["feathers","feathersjs","health","health-checks","healthcheck","healthcheck-endpoint","readiness"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/lwhiteley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-14T21:39:34.000Z","updated_at":"2021-04-01T05:41:51.000Z","dependencies_parsed_at":"2023-02-13T14:00:35.664Z","dependency_job_id":null,"html_url":"https://github.com/lwhiteley/feathers-alive-ready","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwhiteley%2Ffeathers-alive-ready","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwhiteley%2Ffeathers-alive-ready/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwhiteley%2Ffeathers-alive-ready/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwhiteley%2Ffeathers-alive-ready/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lwhiteley","download_url":"https://codeload.github.com/lwhiteley/feathers-alive-ready/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243978597,"owners_count":20378065,"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":["feathers","feathersjs","health","health-checks","healthcheck","healthcheck-endpoint","readiness"],"created_at":"2025-01-23T14:55:15.983Z","updated_at":"2025-03-17T05:27:18.819Z","avatar_url":"https://github.com/lwhiteley.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# feathers-alive-ready\n\n[![npm version](https://badge.fury.io/js/feathers-alive-ready.svg)](https://badge.fury.io/js/feathers-alive-ready)\n[![test-lib](https://github.com/lwhiteley/feathers-alive-ready/workflows/test-lib/badge.svg)](https://github.com/lwhiteley/feathers-alive-ready)\n\nfeathersjs health check endpoints\n\n\u003e a plugin to add health check endpoints to a feathersjs application\n\n## Installation\n\n```\n// install peer dependencies\nnpm install --save @feathersjs/errors @feathersjs/express @feathersjs/feathers\n\n// install module\nnpm install --save feathers-alive-ready\n```\n\n## Setup\n\n### Step 1: Add readiness config\n\n```json\n// default.json\n// add any number of arbitrary keys here, mongoose is just an example\n{\n  \"readiness\": {\n    \"mongoose\": false\n  }\n}\n```\n\n### Step 2: Configure the plugin\n\n```js\nimport feathers from '@feathersjs/feathers';\nimport { health } from 'feathers-alive-ready';\nimport mongoose from './mongoose';\n\n// Initialize the application\nconst app = feathers();\n\n// Initialize the plugin before all other services that may require\n// a health check\napp.configure(health());\napp.configure(mongoose);\n```\n\nWhat happens in step 2\n\nBy default, the plugin will add two endponts `/health/alive` and `/health/ready` to the application.\n\n### Step 3: Tell the application when your service is ready\n\nUse the helper method below to tell the application your service is now ready\n\n```js\n// ./mongoose.ts\n\nimport { setReady } from 'feathers-alive-ready';\n\nexport default function (app: Application) {\n  mongoose\n    .connect(app.get('mongodb'), {\n      useCreateIndex: true,\n      useNewUrlParser: true,\n      useUnifiedTopology: true,\n    })\n    .then(() =\u003e {\n      setReady(app, 'mongoose');\n    })\n    .catch((err) =\u003e {\n      logger.error(err);\n      process.exit(1);\n    });\n\n  mongoose.Promise = global.Promise;\n\n  app.set('mongooseClient', mongoose);\n}\n```\n\nThe `ready` endpoint will not return a positive result until all keys in the `readiness` config are truthy\n\n## Configure\n\nYou can customize the plugin by passing in options.\n\n| Property   | default         | description                                                                                                 |\n| ---------- | :-------------- | ----------------------------------------------------------------------------------------------------------- |\n| configKey  | `readiness`     | which property to look for the readiness config in the app config files                                     |\n| returnData | false           | determines if to return the readiness object in the ready endpoint                                          |\n| aliveUrl   | `/health/alive` | alive endpoint                                                                                              |\n| readyUrl   | `/health/ready` | ready endpoint                                                                                              |\n| customOnly | false           | will only honour custom checks when set to true, if false will honour both readiness config + custom checks |\n| custom     | []              | an array of functions that return a boolean eg. `[(app) =\u003e true]`                                           |\n\n```js\napp.configure(\n  health({\n    configKey: 'readiness',\n    returnData: true,\n    aliveUrl: '/health/alive',\n    readyUrl: '/health/ready',\n  }),\n);\n```\n\n### Optional Configuration\n\nIf you want to do your own custom checks then do the following\n\n```js\napp.configure(\n  health({\n    customOnly: true,\n    custom: [(app: Application) =\u003e !!app.get('mongooseClient')],\n  }),\n);\n```\n\n## License\n\nLicensed under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flwhiteley%2Ffeathers-alive-ready","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flwhiteley%2Ffeathers-alive-ready","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flwhiteley%2Ffeathers-alive-ready/lists"}