I'm building a RESTful api with Express.js. Let's say I have some Users
which own Resources
. A good way to get the Resources
of a specific User
would be: GET /users/:user_id/resources
.
I implemented authentication for the api and can thus get the user_id
from req.user.user_id
instead of from the url. This means I could just use GET /resources
to get the resources from the authenticated user.
My question: is this good practice and why (or why not)?