0

I am integrating with an api that exposes child resources nested under parent resources.

This seems to work fine when I am finding or creating resources from JSData, however, updates and deletes seem to want to access the resource directly.

GET & POST:
/api/parents/:parent_id/children

But, with delete and put requests:

DELETE & PUT
/api/children/:child_id

It seems like if there is a object id involved for the child record then the url that is constructed is constructed at the base level of the API, and if there is no object id, as is the case with POST and GET (findAll).

Is there something very obvious that I am missing here?

4

1 回答 1

0

在阅读了更多关于 JS-Data 中的关系之后:http: //www.js-data.io/docs/relations

我看到了这部分,

    // if you add this to a belongsTo relation
    // then js-data will attempt to use
    // a nested url structure, e.g. /organization/15/user/4
    parent: true

在“定义关系”标题下。parent: true我认为与 JS-Data 路由器混淆的配置有两个关系 。

于 2016-02-23T07:45:38.687 回答