-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Factor out core to support HAPI, Express, Koa and others #11
Comments
@helfer @bkinsey808 @TimMikeladze moving the architecture discussion from the typescript #8 discussion. As I mentioned before I have a prototype based on the following architecture:
I now have a working version of my prototype. It is very naive and returns a hardcoded response but both express and hapi servers are running and responding GQL requests that is parsed and validated. It currently only works on posts with a query in the body. Let me know what you think |
I'm back from the long weekend and I gave this some thought. I think @nnance 's repo is a great start, so that can be our reference. I'd like the core of apolloServer to simply be a function, which takes a few more parameters than the
I don't really follow any specific notation here, but I think you get the idea. Instead of passing params to apolloServer, you could also pass a function, which returns a promise (similar to express-graphql). Using a function over say an instance of a class has the advantage of staying more flexible without really incurring any cost.
All other parameters work the same as they do for The most important difference to the current apolloServer is that it does no longer take a schema definition in schema language and connectors. Instead, people will use graphql-tools to generate an executableSchema. Let me know what you guys think. Would this cover your use cases? |
On second thought, it might make sense to also take a It definitely should not take a |
Would somebody pls be willing to explain to me the plan for supporting databases? Will it support multiple databases? Nosql, relational? Will the graphql schema be autogen'd from the db schema? |
I'm also really interested in autogen-ing typescript types from graphql types, Is that possibly in the mix? |
@bkinsey808 it's on our radar, but not on our short-term roadmap. If you want to discuss further, you can open a separate issue for each topic. :) |
@helfer I like including the option for pre-stored queries |
@HriBB we've made some good progress, you can see it on the core-refactor branch. We have a working & tested small core in typescript and are now adding express integration to it. Nick is going to be working on the HAPI integration. If you want, you could get the express thing working. As a first step, we want it to reproduce the express-graphql functionality, and pass all the tests that express-graphql passes. Is that something you would be interested in working on? Or what are you most interested in? |
@helfer I would love to help, but need to do some reading first ;) I can work on express and koa integrations. I'm pretty busy these days, finishing some project, so I will have more time in a week or so. |
@HriBB I think that's perfect timing. By then we'll have a working Express and HAPI integration I think, so you should be able to use those to guide a Koa integration. |
@helfer this is my first try on koaApollo HriBB@f11a94f Trying to implement this with npm link I am getting
|
@HriBB That error usually happens when there's more than one version of GraphQL-js installed in your project. Are you using npm 2 by any chance? In that case you probably have to run |
@helfer so I fixed the instance problem. Now I'm trying to create executable schema and pass it to the koaApollo(), but I'm getting this error
koaApollo.js
and my server.js
|
Are your connectors classes with a constructor that takes the context as an argument? |
Nope, my connectors are sequelize models. OK, so I guess I need to convert my connectors to functions? |
Yeah, the connectors are something we came up with a while ago, but they've changed shape a little bit. My suggestion would be to remove the connectors from your call to |
@helfer It works! Thanks for your help. |
For the current status of this, see #41 |
@helfer yes I've been monitoring the progress and will start next week. From what I have seen it should not take me too long to have a working and tested implementation. I already have one with the slightly older version and without graphiql. |
@HriBB are you still interested in working on an implementation for Koa? |
@helfer yes, trying to find some time to work on this ... today looks rainy enough :) |
…istered op-reg: Only forbid operations if `forbidUnregisteredOperations` is set.
…istered op-reg: Only forbid operations if `forbidUnregisteredOperations` is set.
Add support for the HAPI web framework while continuing support for Express. The intent here is to offer support for both frameworks in a consistently or such that the API works well with each framework and detects which binding is being used.
I believe it is likely we will need an integration with HAPI much like express-graphql.
The text was updated successfully, but these errors were encountered: