Tuesday 27 August 2019

Run a node app as a child process and start/stop from an API?

I have a node app (known as Alfred) that runs some services on our network at work. It's pretty hacky...and occasionally gets into a bad state and needs to be restarted. I'm not always around to do this, the company won't give me a laptop to remote in, and it causes problems if it's in this state for too long say, over a weekend). So here's my proposed solution:I want to run a simple Express server with an API that can start or stop my Alfred service. There would be a button on Alfred's front end that would hit this API, which would stop the main Alfred process, then start it again. Alfred would initially get started when I run this API server.Is this feasible, and if so, how might I accomplish it? The only I know for sure is that I would have to host this API on a different port than what Alfred is listening on...I think...and I feel like the child_process package might be involved?

Submitted August 28, 2019 at 12:48AM by PM_ME_A_WEBSITE_IDEA

No comments:

Post a Comment