0

I realize this question is a bit subjective, but I still decided to ask it as any piece of advice will be helpful (suggestions in comments are perfectly fine).

I have a nodejs server (1) that acts as reverse-proxy. As part of starting up this reverse-proxy server (1), I want it to child_process.spawn() another nodejs webserver (2) that I will be proxying to. This another webserver (2) is basically a rendering framework (nextjs).

I've googled around and haven't found an article describing the setup like this. What are potential pitfalls of such setup I should be aware of? My idea is that when it comes to stdout and stderr this server (2) will be running similar to starting it from command line or pm2.

Max Koretskyi
  • 101,079
  • 60
  • 333
  • 488
  • 1
    I guess one pitfall can be that the child process will keep running when the parent process exists. The parent will literally just spawn it and that's it. I don't see a benefit over using something like npm-run-all to start both servers. – The Fool Dec 04 '20 at 19:24
  • @TheFool, thanks, I'm also considering using pm2 to run those two servers [like this](https://stackoverflow.com/a/47920062/2545680) – Max Koretskyi Dec 04 '20 at 20:26

0 Answers0