I'm building an E-commerce site, where there's an Authentication system.
I noticed that if the client login with a wrong user or password, the backend/server that works with nodemon
will crach and hang in there crashed till i restart manually nodemon
. This is example output error of the nodemon
crash:
[nodemon] app crashed - waiting for file changes before starting...
node:internal/errors:464 ErrorCaptureStackTrace(err);
^
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
Ofcourse, when server crashes, client can no more access or do login again till server restarts. After some googling, i found this question and this repository that fix my problem but particulary and not as expected precisely, i dont want nodemon to restart forever on any error that occure ofcourse, but only with specifics errors that i set them -like Authentication errors as i mentionned above-.
So, my idea/question is: is there anyway to get nodemon
restarts by itself in some cases of failures or errors (NOT ALL)?
nodemon
package to work the way i expect it to ? – Basinger