Tuesday 8 May 2018

Express Js best practices

1. Try - catch
2. Better Error handling
3. JSLint to see if any reference errors on undefined variables.
4. Try-catch works only for synchronous code. Because the Node platform is primarily asynchronous (particularly in a production environment), try-catch won’t catch a lot of exceptions.
5.Promises will handle any exceptions (both explicit and implicit) in asynchronous code blocks that use then(). Just add .catch(next) to the end of promise chains

Production Best Practices

No comments:

Post a Comment