Last active
July 27, 2020 22:09
-
-
Save ashutoshpw/c15c540b61531db9daac6658825a300d to your computer and use it in GitHub Desktop.
express-errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place this after all the routes and middlewares | |
app.all("*", (req, res, next)=>{ | |
return res.send("Route Doesn't exists"); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get("/", (req, res, next) => { | |
// Throw and Error knowingly. Another example could be | |
// let x = null.split(","); | |
throw new Error('Something Wrong'); | |
return res.send("Hello World"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment