{"id":21745390,"url":"https://github.com/palmerabollo/express-ping","last_synced_at":"2025-04-13T05:12:38.223Z","repository":{"id":12506607,"uuid":"15176255","full_name":"palmerabollo/express-ping","owner":"palmerabollo","description":"Let all your express applications expose a common API to inform about their internal status and health.","archived":false,"fork":false,"pushed_at":"2021-03-22T19:09:56.000Z","size":23,"stargazers_count":51,"open_issues_count":3,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T22:05:42.096Z","etag":null,"topics":["express","middleware","monitoring"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/palmerabollo.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":"2013-12-13T23:10:07.000Z","updated_at":"2024-09-17T18:16:15.000Z","dependencies_parsed_at":"2022-08-30T15:20:57.876Z","dependency_job_id":null,"html_url":"https://github.com/palmerabollo/express-ping","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/palmerabollo%2Fexpress-ping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmerabollo%2Fexpress-ping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmerabollo%2Fexpress-ping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmerabollo%2Fexpress-ping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/palmerabollo","download_url":"https://codeload.github.com/palmerabollo/express-ping/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665746,"owners_count":21142123,"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":["express","middleware","monitoring"],"created_at":"2024-11-26T07:15:31.147Z","updated_at":"2025-04-13T05:12:38.203Z","avatar_url":"https://github.com/palmerabollo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"express-ping\n============\n\nLet your express applications **expose a simple API to inform about its internal status** and health to both operators and to other applications.\n\nThis module was created as an express middleware to simplify its usage. Add a **single line** to your express application and you are done.\n\nUsage\n-----\n\n* Add \"express-ping\" to your package.json dependencies (```npm install express-ping --save```)\n* Include the middleware in your express application:\n\n```javascript\nvar health = require('express-ping');\nvar express = require('express');\n\nvar app = express();\n...\napp.use(health.ping()); // this is the only addition\napp.use(app.router);\n...\n\napp.listen(3000);\n```\n\nOnce you launch your express application, it will add a new **/ping** endpoint to check the app status. If you **GET http://localhost:3000/ping** you will receive the following information:\n\n```json\n{\n  \"timestamp\": 1406542638314,\n  \"uptime\": 6,\n  \"application\": {\n    \"name\": \"express-ping-example\",\n    \"version\": \"1.2.3\",\n    \"pid\": 47633,\n    \"title\": \"node\",\n    \"argv\": [\n      \"node\",\n      \"/private/tmp/express-ping/examples/server.js\"\n    ],\n    \"versions\": {\n      \"http_parser\": \"1.0\",\n      \"node\": \"0.10.26\",\n      \"v8\": \"3.14.5.9\",\n      \"ares\": \"1.9.0-DEV\",\n      \"uv\": \"0.10.25\",\n      \"zlib\": \"1.2.3\",\n      \"modules\": \"11\",\n      \"openssl\": \"1.0.1e\"\n    }\n  },\n  \"resources\": {\n    \"memory\": {\n      \"rss\": 25481216,\n      \"heapTotal\": 17603072,\n      \"heapUsed\": 7394608\n    },\n    \"loadavg\": [\n      1.1484375,\n      1.46923828125,\n      1.66015625\n    ],\n    \"cpu\": [\n      {\n        \"model\": \"Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz\",\n        \"speed\": 2300,\n        \"times\": {\n          \"user\": 114993850,\n          \"nice\": 0,\n          \"sys\": 103728020,\n          \"idle\": 503833400,\n          \"irq\": 0\n        }\n      },\n      {\n        \"model\": \"Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz\",\n        \"speed\": 2300,\n        \"times\": {\n          \"user\": 57503220,\n          \"nice\": 0,\n          \"sys\": 35838280,\n          \"idle\": 624247570,\n          \"irq\": 0\n        }\n      },\n      {\n        \"model\": \"Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz\",\n        \"speed\": 2300,\n        \"times\": {\n          \"user\": 102379040,\n          \"nice\": 0,\n          \"sys\": 82181270,\n          \"idle\": 533028910,\n          \"irq\": 0\n        }\n      },\n      {\n        \"model\": \"Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz\",\n        \"speed\": 2300,\n        \"times\": {\n          \"user\": 51145170,\n          \"nice\": 0,\n          \"sys\": 26503950,\n          \"idle\": 639939820,\n          \"irq\": 0\n        }\n      }\n    ],\n    \"disk\": [\n      {\n        \"filesystem\": \"/dev/disk0s2\",\n        \"size\": 487546976,\n        \"used\": 349343740,\n        \"available\": 137947236,\n        \"capacity\": 0.72,\n        \"mount\": \"/\"\n      },\n      {\n        \"filesystem\": \"devfs\",\n        \"size\": 201,\n        \"used\": 201,\n        \"available\": 0,\n        \"capacity\": 1,\n        \"mount\": \"/dev\"\n      },\n      {\n        \"filesystem\": \"map -hosts\",\n        \"size\": 0,\n        \"used\": 0,\n        \"available\": 0,\n        \"capacity\": 1,\n        \"mount\": \"/net\"\n      },\n      {\n        \"filesystem\": \"map auto_home\",\n        \"size\": 0,\n        \"used\": 0,\n        \"available\": 0,\n        \"capacity\": 1,\n        \"mount\": \"/home\"\n      }\n    ],\n    \"nics\": {\n      \"lo0\": [\n        {\n          \"address\": \"::1\",\n          \"family\": \"IPv6\",\n          \"internal\": true\n        },\n        {\n          \"address\": \"127.0.0.1\",\n          \"family\": \"IPv4\",\n          \"internal\": true\n        },\n        {\n          \"address\": \"fe80::1\",\n          \"family\": \"IPv6\",\n          \"internal\": true\n        }\n      ],\n      \"en1\": [\n        {\n          \"address\": \"fe80::e6ce:8fff:fe36:c616\",\n          \"family\": \"IPv6\",\n          \"internal\": false\n        },\n        {\n          \"address\": \"192.168.1.33\",\n          \"family\": \"IPv4\",\n          \"internal\": false\n        }\n      ],\n      \"vboxnet1\": [\n        {\n          \"address\": \"10.10.10.1\",\n          \"family\": \"IPv4\",\n          \"internal\": false\n        }\n      ]\n    }\n  },\n  \"system\": {\n    \"arch\": \"x64\",\n    \"platform\": \"darwin\",\n    \"type\": \"Darwin\",\n    \"release\": \"13.2.0\",\n    \"hostname\": \"tizona.local\",\n    \"uptime\": 1608435,\n    \"cores\": 4,\n    \"memory\": 8589934592\n  }\n}\n```\n\nConfiguration\n-------------\n\nYou don't need to configure anything. By default, a `/ping` endpoint will be added to your routes, but you can pass the _ping_ endpoint to the middeware simply doing:\n\n```js\napp.use(health.ping('/custompath'));\n```\n\nTo provide **authorized access**, use a middleware (i.e. [connect-basic-auth](https://github.com/c4milo/connect-basic-auth)) before express-ping. Example:\n\n```\napp.get('/ping', basicAuth('username', 'password'));\napp.use(health.ping('/ping'));\n```\n\nNotes\n-----\n\n* [Debate around the JSON organization](https://github.com/palmerabollo/express-ping/wiki/Response-Format-Debate) (contributions are welcome).\n* Port for koa.js [koa-ping](https://github.com/AlexeyKhristov/koa-ping)\n\nLicense\n-------\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalmerabollo%2Fexpress-ping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpalmerabollo%2Fexpress-ping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalmerabollo%2Fexpress-ping/lists"}