Any way to reboot my project without editing code?


#1

Its kind of annoying having to change code to get my project to restart, so I was wondering if there is some sort of reboot button somewhere? Or maybe some way to force the program to stop if it gets stuck doing stuff.


#2

You might be able to create an endpoint in your server that terminates the process when you hit it:

app.get("/shutdown", (req, res) => {
  res.end("OK");
  // A small timeout so that the app has the time to respond
  setTimeout(() => {
    process.exit(0);
  }, 500);
});

Glitch will restart the app automatically.


#3

I usually change the throttle in my watch.json when I want to restart my app.


#4

Easiest wat

process.exit(1)

It would restart the whole project.
Also, if you are on a ndoe-express application, it would install new packages, you added.