Guest User

Untitled

a guest
Jun 22nd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. const express = require('express');
  2. const app = express();
  3.  
  4. app.get('/', (req, res) => {
  5. res.end(`Hello PID: ${process.pid}`);
  6. });
  7.  
  8. let status = 200;
  9. setTimeout(() => {
  10. status = 503;
  11. console.log('Status changed to 503');
  12. }, 20000);
  13. app.get('/check', (req, res) => {
  14. console.log(`Health Check Request ${status}`);
  15. res.status(status).end();
  16. });
  17.  
  18. app.listen(process.env.PORT);
  19. console.log(`Api Server running on ${process.env.PORT} port, PID: ${process.pid}`);
Add Comment
Please, Sign In to add comment