Wednesday, 17 July 2019

Need help validating url and changing status code using express

How can I check to see if a url path that was requested by the client is correct? As in, if the client types in “google.com/pics/dogs” it should respond correctly and with a 200 status code. But if they typed “google.com/plicks/dogz” it should be invalid and the status code should be 401.I’m guessing it has to do with using a conditional to check if the request matches the endpoint(/pics) but I’m not sure how to word it.

Submitted July 17, 2019 at 07:24PM by webhead311

No comments:

Post a Comment