I'm new to Express and have a question about how best to approach path parameters. I've defined some paths that look like the following:/objects /objects/:objectId /objects/:objectId/:itemWithinAnObjectId However, it seems like when I make a request to something like/objects/42/1 the handlers for both/objects/:objectId /objects/:objectId/:itemWithinAnObjectId are run.How do I get it to match the longest path? Should I just define one path and use '?' to make objectId and itemId optional?
Submitted June 23, 2020 at 08:38PM by wait_recordscratch
No comments:
Post a Comment