I want my worker server to pickup tasks from parent server immediately after it starts and keep pinging for pending tasks.
Given that Nodejs is a event driven, how do I make my express server make a rest call to server and start working immediately after start?
In a way, I am asking for setup method in Nodejs.
You have your server.js
file (the one you call node server.js
on).
Simply place whatever code you need to run at bootstrap there.
var express = require("express");
...
yourSetupFunction();
app.listen(1337);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With