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

Support many-to-many relationships #29

Open
ivanalejandro0 opened this issue Nov 20, 2017 · 2 comments
Open

Support many-to-many relationships #29

ivanalejandro0 opened this issue Nov 20, 2017 · 2 comments

Comments

@ivanalejandro0
Copy link

It seems that I can't do this right now:

module.exports = {
    posts: [
        { id: 1, title: "Lorem Ipsum", views: 254, user_id: [123, 456] },
        { id: 2, title: "Sic Dolor amet", views: 65, user_id: [456, 457] },
    ],
    users: [
        { id: 123, name: "John Doe" },
        { id: 456, name: "Jane Doe" },
        { id: 457, name: "Xavier" }
    ],
    comments: [
        { id: 987, post_id: 1, body: "Consectetur adipiscing elit", date: new Date('2017-07-03') },
        { id: 995, post_id: 1, body: "Nam molestie pellentesque dui", date: new Date('2017-08-17') }
    ]
}

Is this not supported? or maybe there's a different way of doing it?

p.s.: this would be something like a combined authorship post. This is not my actual use case though, but close enough to show the problem and with a little change of the provided example.

p.s. 2: great tool, keep it up :)

@szkrd
Copy link

szkrd commented Feb 11, 2018

It's not supported in json-server (the "inspiration" for this project), so I have my doubts, but it would be really wonderful :)

@mikkelking
Copy link

mikkelking commented Nov 25, 2018

There is a fork by @mrtsven for relational data that may be what you want? https://github.com/marmelab/json-graphql-server/network

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

No branches or pull requests

4 participants