I have a script Start.js
which is starting another script Server.js
using shelljs
.
Server.js
contains a express server which should run at process.env.PORT
.
Start.js
should print out if the server was started correctly or not.
const process = shell.exec(`node Server.js`, {
async: true,
env: {
PORT: 3000
}
}) as ChildProcess;
// how to detect that server was successfully started?
How can this script detect if the server was successfully started?