json-server
json-server copied to clipboard
Expand/Embed multiple levels of ancestors/descendants
Hello,
Is it possible to expand multiple levels of the parents / children (parent of the parent, etc.) For example, for the following db.json:
{
"users": [
{
"id": 1,
"name": "a"
},
{
"id": 2,
"name": "b"
},
{
"id": 1,
"name": "c"
},
{
"id": 1,
"name": "d"
}
],
"posts": [
{
"id": 1,
"title": "post1",
"userId": 1
},
{
"id": 2,
"title": "post2",
"userId": 1
},
{
"id": 3,
"title": "post3",
"userId": 2
},
{
"id": 4,
"title": "post4",
"userId": 2
}
],
"sections": [
{
"id": 1,
"postId": 1
},
{
"id": 2,
"postId": 1
},
{
"id": 3,
"postId": 1
},
{
"id": 4,
"postId": 2
},
{
"id": 1,
"postId": 2
}
]
}
Would it be possible to run /sections?_expand=post&_expand=user&userId=1 to get
{
"id": 1,
"postId": 1,
"post":
{
"id": 1,
"title": "post1",
"userId": 1,
"user":
{
"id": 1,
"name": "a"
}
}
}
I am in this situation too.
Any update?
same here, I thought that &_expand=entity&_expand=entity.entityStatus might work, but didn't