Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Read Endpoint] Get data from two models #230

Open
abhishekchotaliya opened this issue May 4, 2018 · 1 comment
Open

[Read Endpoint] Get data from two models #230

abhishekchotaliya opened this issue May 4, 2018 · 1 comment

Comments

@abhishekchotaliya
Copy link

Using association, I can request /book/2/chapters, which will give me chapters data of book 2(But no book data).

But is there any 'hack' by which I can get book data + chapters data from the same url? something like this?

{
    "book": {
        ... all book 2 data ... ,
        "chapters": {
            ... all book 2 chapters data ....
        }
    }
}

If not, then is it possible to get a similar result with the use of middleware?

@kevboutin
Copy link

You are better off using a hasMany relationship and asking for book 2 for example. An example can be found here: #235.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants