mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-12 18:32:44 +00:00
add healthcheck
This commit is contained in:
23
healthcheck.js
Normal file
23
healthcheck.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const http = require("http");
|
||||
const config = require("./config");
|
||||
|
||||
const options = {
|
||||
host: "localhost",
|
||||
port: config.PORT,
|
||||
timeout: 2000,
|
||||
};
|
||||
|
||||
const request = http.request(options, (res) => {
|
||||
if (res.statusCode == 200) {
|
||||
process.exit(0);
|
||||
} else {
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
request.on("error", (err) => {
|
||||
console.log("ERROR");
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
request.end();
|
||||
Reference in New Issue
Block a user