I have set up a Parse Server on an ubuntu, and every time I add a modification to the index.js I have to restart, which takes 4 or 5 seconds to come back to life.
Is there a better way to add changes without crashing the server?
I have set up a Parse Server on an ubuntu, and every time I add a modification to the index.js I have to restart, which takes 4 or 5 seconds to come back to life.
Is there a better way to add changes without crashing the server?
The answer is yes and no
For the example you asked about (the connection to the base) there is a solution. Instead of having your index.js like this:
you can have a database wrapper that only wraps that part:
Response analysis
node index.js
start
is necessary to see how much of the 4 or 5 seconds are taken by tasks that must be done again/reset
from the browser, you can choose other triggers, for example onewatchFile
that is watching if there were modifications in the configuration file.start
for each type of thing, one for the database, another to read templates from disk, another to change ports, etc.conclusion
There is no magic solution , everything has to be tested and programmed, someone pays the cost , the programmer programming, the programmer waiting for it to start on each reboot, the user with low performance (of something that is constantly checking if it has changed) , the user with the probability that something has an error.
install forever
and then start your app (in debug mode) with:
then if you make any changes in your index.js you will have an output like this
The -w flag tells node to watch for a change in the index.js file and to restart, it interprets it as an error but it isn't.