Skip to content

Instantly share code, notes, and snippets.

@nairihar
Last active June 21, 2018 13:22
Show Gist options
  • Save nairihar/9e77d050031989597f62be468a844055 to your computer and use it in GitHub Desktop.
Save nairihar/9e77d050031989597f62be468a844055 to your computer and use it in GitHub Desktop.
NodeJS Health Check and Overload Protection, medium
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.end(`Hello PID: ${process.pid}`);
});
app.get('/check', (req, res) => {
console.log('Health Check Request');
res.status(200).end();
});
app.listen(process.env.PORT);
console.log(`Api Server running on ${process.env.PORT} port, PID: ${process.pid}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment