Hey!
I’m wondering if it is possible to restart a glitch project via the code? So for example if I’d make an express endpoint that will make the application be rebooted?
If yes, how would I approach this? Thanks in avdance!
Kr,
Jonas
Hey!
I’m wondering if it is possible to restart a glitch project via the code? So for example if I’d make an express endpoint that will make the application be rebooted?
If yes, how would I approach this? Thanks in avdance!
Kr,
Jonas
Hello @JonasTheGamer!
Glitch will automatically restart a node process that has exited (as long as the project is otherwise allowed to be awake per our limits). You should be able to call process.exit()
in your node server when you want the server to shut down, and then Glitch will start it back up.
@potch Just to clarify, Glitch would restart the project immediately or would it wait until the next incoming HTTP request? Also I assume a Python sys.exit()
would behave similarly?
Hi,
Thanks a lot. That’s exactly what I needed.
Kr
Jonas
sys.exit is a function that (in python) tells the script to shut down. It would not shut down the server as with nodejs