I have created a simple app with Nodejs and express that shows data fetched from an API. I want to create a button in the frontend that should restart Node Server. Is this possible conceptually? if not, Do we have workaround?
Asked
Active
Viewed 1,184 times
3
-
Use a process manager such as `pm2` with auto restarts, and call `process.exit()` in the express endpoint. – Azami Feb 11 '19 at 14:51
-
Have a look at this-https://stackoverflow.com/questions/35034997/how-to-execute-node-console-command-from-javascript-file-on-click-via-ajax – Shubham Dixit Feb 11 '19 at 14:53
-
I think this link contains the solution to your question. https://stackoverflow.com/questions/24666696/restart-a-node-js-app-from-code-level – varun agarwal Feb 11 '19 at 14:54