jeudi 30 juin 2016

How to change default findAll endpoint

I'm doing a app that have several users, and each user hasMany mappings.

So, i'm not using JSONAPAdapter because i'm working with strongloop, so i'm using RESTAdapter with JSONSerializer.

All my mappings routes in the backend work like this:

GET        /users/{userId}/mappings
POST     /users/{userId}/mappings
PUT       /users/{userId}/mappings
DELETE /users/{userId}/mappings
GET        /users/{userId}/mappings/{mappingId}
.....

So, i want get all mappings from the logged user. How to do so? I'm trying like this:

this.store.query('mapping', {
   userId: userId
});

But doesn't work at all. Is trying to get the data from /mappings/{userId}

Is it possible to overwrite the default findAll url? How so?

Thanks!




Aucun commentaire:

Enregistrer un commentaire