TaitoUnited / full-stack-template

Template for cloud-native applications and microservices running as containers/functions on Kubernetes, Docker Compose, or cloud. You can choose the stack during project creation.
https://taitounited.github.io/taito-cli/templates
MIT License
36 stars 8 forks source link

GraphQL gateway #1

Open keskiju opened 6 years ago

keskiju commented 6 years ago

Some people are saying that GraphQL will replace REST altogether in APIs, but it might just be hype, and it's probably best to keep both in your toolbox.

REST with HTTP/2 push might actually prove to be quite fast. If you fetch a list of A's that have references to B's, C's and D's, the API gateway can send you a list of A's immediately and the B's, C's and D's are pushed later once they have been fetched from the other service endpoints. You can also utilize http caching with REST. And it would also be quite trivial for the API gateway to provide a generic property filtering mechanism in case the client only requires a couple of fields from each entity.

keskiju commented 6 years ago

Some misc links: https://blog.graph.cool/graphql-boilerplates-graphql-create-how-to-setup-a-graphql-project-6428be2f3a5

keskiju commented 6 years ago

https://jakearchibald.com/2017/h2-push-tougher-than-i-thought/

keskiju commented 5 years ago

Perhaps we can forget HTTP/2 push for now. The template already includes an empty graphql container. We should implement two examples with Apollo:

The graphql implementation should use the same libs as server implementation as much as possible. That is, use koa instead of express. This makes future updates easier. And of course, we should also implement a page with React that uses the GraphQL API. Just use the existing posts and files database tables to implement the example, no need to create more db tables. You can add new columns though.

Based on these examples provided by the template you can: