I'm using postgres and express and forgive me, I'm new to backend stuff. I have a route /api/debt/:id to get a single debt item. When I make a request for /api/debt/3 or any invalid UUID I get an error (as expected) from postgres:invalid input syntax for type uuid: "3" My question is, what's the best practice way to handle this?Did I possibly set my column type incorrectly?Do I need to check if it's a valid UUID first, and if it's not then return status 400 before running the query?
Submitted August 02, 2020 at 04:39AM by Division2226
No comments:
Post a Comment