I've been trying to do health check of first server inside serverTwo function using node js.
Here is my code.
const http = require('http');
const express = require('express');
http.createServer(serverOne).listen(8080);
http.createServer(serverTwo).listen(8081);
function serverOne (req, res) {
res.write('Server running at http://localhost:8080\n');
console.log("running serverOne\n");
res.end();
}
function serverTwo (req, res) {
res.write('Server running at http://localhost:8081\n');
console.log("running serverTwo\n");
res.end();
}