You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
445 B
JavaScript
24 lines
445 B
JavaScript
const http = require('http');
|
|
const options = {
|
|
host: 'localhost',
|
|
port: 1337,
|
|
timeout: 2000
|
|
};
|
|
|
|
const healthCheck = http.request(options, (res) => {
|
|
console.log(`HEALTHCHECK STATUS: ${res.statusCode}`);
|
|
if (res.statusCode == 200) {
|
|
process.exit(0);
|
|
}
|
|
else {
|
|
process.exit(1);
|
|
}
|
|
});
|
|
|
|
healthCheck.on('error', function (err) {
|
|
console.error('ERROR');
|
|
process.exit(1);
|
|
});
|
|
|
|
healthCheck.end();
|