devour-client icon indicating copy to clipboard operation
devour-client copied to clipboard

Changing a resource URL / adding a namespace

Open Startouf opened this issue 7 years ago • 1 comments

Suppose my API is there https://www.example.com/api/

But that depending on the type of users/access control, I have namespaces that allow to get more or less information

https://www.example.com/api/admin/users (when providing an admin auth token + requesting more detailed info) VS https://www.example.com/api/public/users

Can I override the resource URL when making a request ?

Startouf avatar Feb 11 '18 14:02 Startouf

Hey there, you can set a custom URL when you define a resource, but not aware of any way to do it when you make the request:

https://github.com/twg/devour/blob/3836582fc823421ce32f318294b79ec6dec32ded/test/api/api-test.js#L175-L178

I suppose you could define two resources, with more attributes in the admin one

erkde avatar Feb 15 '18 05:02 erkde