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

Example for a MongoDB based server #180

Closed
the-petrolhead opened this issue Dec 5, 2019 · 1 comment
Closed

Example for a MongoDB based server #180

the-petrolhead opened this issue Dec 5, 2019 · 1 comment

Comments

@the-petrolhead
Copy link

the-petrolhead commented Dec 5, 2019

Hi,

I'm fairly new to JS/TS client-server development. Pardon my choice of words.

@leebenson
ReactQL seems to be a great starter for client. Thanks for your efforts.
I already started exploring it and wondering if there is an example of hooking up a MongoDB-GraphQL server?

I'm asking this since ReactQL as frontend starter has made some great choices in terms of developer productivity. I would want to ease the server development as well.

Any recommended starter projects exist for Mongo-GraphQL? I was able o find following but not sure how could I hook them in the ReactQL project.
https://github.com/the-road-to-graphql/fullstack-apollo-react-boilerplate
https://github.com/arackaf/mongo-graphql-starter

@leebenson
Copy link
Owner

leebenson commented Dec 6, 2019

There's no example of bolting on a GraphQL server in the kit, but you can add one to the router at https://github.com/leebenson/reactql/blob/master/src/runner/app.ts

You'd basically create a /graphql endpoint (or whatever you want to call it), and add in either the GraphQL reference implementation, or a more complete framework like Apollo Server to handle your queries.

Adding MongoDB would be a case of applying that logic inside the GraphQL resolver, based on whatever business rules make sense. You could use an ORM or the standard MongoDB lib for this.

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