What is PHP exit()/die() equivalent in Node.js
What is the PHP [die()
]/(http://www.php.net/manual/de/function.die.php) equivalent in Node.js?
https://www.php.net/manual/de/function.exit.php
process.exit()
is the equivalent call.
I would use throw
. Throw will cause the current request at hand to end, and will not terminate the node process. You can catch that output using your error view.
throw new Error('your die message here');