{"id":22059290,"url":"https://github.com/opentable/hapi-service-status","last_synced_at":"2025-03-23T17:13:29.945Z","repository":{"id":18452221,"uuid":"21645741","full_name":"opentable/hapi-service-status","owner":"opentable","description":"service-status endpoint for hapi.js","archived":false,"fork":false,"pushed_at":"2015-07-06T09:55:26.000Z","size":255,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-14T09:05:29.620Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/opentable.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":"2014-07-09T08:55:33.000Z","updated_at":"2019-04-11T17:14:08.000Z","dependencies_parsed_at":"2022-08-05T00:00:12.352Z","dependency_job_id":null,"html_url":"https://github.com/opentable/hapi-service-status","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentable%2Fhapi-service-status","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentable%2Fhapi-service-status/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentable%2Fhapi-service-status/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentable%2Fhapi-service-status/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opentable","download_url":"https://codeload.github.com/opentable/hapi-service-status/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245136405,"owners_count":20566588,"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":[],"created_at":"2024-11-30T17:27:52.597Z","updated_at":"2025-03-23T17:13:29.910Z","avatar_url":"https://github.com/opentable.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#Hapi service-status\n[![Build Status](https://travis-ci.org/opentable/hapi-service-status.png?branch=master)](https://travis-ci.org/opentable/hapi-service-status) [![NPM version](https://badge.fury.io/js/hapi-service-status.png)](http://badge.fury.io/js/hapi-service-status) ![Dependencies](https://david-dm.org/opentable/hapi-service-status.png)\n\nShared code for the `service-status` endpoint.\n\nPerforms a check by injecting a request to a specified endpoint (using server.inject).\n\nInstallation:\n\n```npm install --save hapi-service-status```\n\nUsage:\n\n```\nvar server = hapi.createServer();\n\nserver.pack.register(\n  {\n      plugin: require(\"hapi-service-status\"),\n      options: {\n        failureStatusCode: 500,         // status code of the service-status response when monitor fails, default value is 200\n        monitors: [\n          {\n            monitorname: 'mymonitor1',\n            path: '/my/route/to/test/123',\n            headers: {},\n            timeout: 500 // if the request takes longer than this time (ms) then report as 'Failed'\n          },\n          {\n            monitorname: 'mymonitor2',\n            path: '/my/other/route/321',\n            headers: {},\n            compare: function(body){     // this function should return true or false based on body content\n              return body.foo == \"bar\";  // returning false will result in a 'Failed' status\n            }\n          },\n          {\n            monitorname: 'mymonitor3',\n            path: '/my/other/other/route',\n            headers: {},\n            timeout: 500,\n            selfTest: false // exclude this monitor from the selfTest() function\n          }\n          // ...\n        ]\n        default: 1\n      }\n  },\n  function (err){\n    if(err){\n      throw err;\n    }\n  }\n);\n```\n\nRoutes:\n\n\n- `/service-status`                // runs the default monitor\n- `/service-status/{monitorname}`  // runs the named monitor\n- `/service-status/all`            // runs all monitors, use with caution\n\n\nSelfTest:\n\nProvides a method to run all the monitors and assert they are successful. Useful for a startup-self test.\n\n```\n\nserver.start(function(){\n  server.plugins['hapi-service-status'].selfTest(function(err){\n      if(err){\n        throw err;\n      }\n    });\n});\n```\n\n\nFuture plans:\n\n- Maybe Ok/Warn/Fail threshold?\n- Optionally fail on a 404\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentable%2Fhapi-service-status","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopentable%2Fhapi-service-status","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentable%2Fhapi-service-status/lists"}