How to make different pre-processors for collection and resource (GET /resources & GET /resources/:id)
Greetings, is it possible to differentiate between GET /resources & GET /resources/:id? The point is that I want the user with one role have access only to GET /resources/:id but not to GET /resources. And for admin allow all of them for example.
Another words I want to be able to set different role policies for GET /resources & GET /resources/:id.
Can you point out on possible solution?
You could use before middle wear to check the path and user and then either return next() or next(401) for unauthorised.
Yeah, I think @OmgImAlexis presents the best solution right now.
I played around making this a bit easier. A good project if anyone wants to work on it.