Hi,I'm starting to learn nodeJS + mongoose and let's say I make an arbitrary endpoint like /blogs/:blogId, I want to return a 404 whenever it the id is not found, but if I type in anything that isn't a objectID for blogId it throws an exception? How can I get around that? I want to be able to throw a 404 for say the value 1 or 2 even if it isn't a valid objectID?
Submitted May 28, 2020 at 05:24AM by wastedtimez
No comments:
Post a Comment