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

feat(examples): refactor api-routes-graphql to GraphQL Yoga #36155

Merged
merged 15 commits into from
May 23, 2022

Conversation

charlypoly
Copy link
Contributor

@charlypoly charlypoly commented Apr 14, 2022

GraphQL Yoga provides a more extensible experience (Envelop plugins) and lighter bundle than the previously showcased apollo-server-micro (64.5kB vs 196.2kB - min & GZiped)

Similar to Next.js, GraphQL Yoga comes with strong defaults and out-of-the-box support for modern GraphQL features (File uploads, subscriptions, and more).

Strong of many years of existence and a large community, GraphQL Yoga 2.0 comes with Next.js support with no additional package or configuration 📦

GraphQL Yoga provides a more extensible (Envelop plugins](https://envelop.dev/)) and lighter bundle than the previously showcased `apollo-server-micro` ([64.5kB](https://bundlephobia.com/package/@graphql-yoga/node@2.2.1) vs [196.2kB](https://bundlephobia.com/package/apollo-server-micro@3.6.7) - min & GZiped)

Similarly to Next.js, GraphQL Yoga comes with strong defaults and out of the box support for modern GraphQL features (File uploads, subscriptions, and more).
@ijjk ijjk added the examples Issue/PR related to examples label Apr 14, 2022
dotansimha
dotansimha previously approved these changes Apr 14, 2022
@@ -1,6 +1,24 @@
# API routes with GraphQL server

Next.js ships with [API routes](https://nextjs.org/docs/api-routes/introduction), which provide an easy solution to build your own `API`. This example shows their usage alongside [apollo-server-micro](https://github.com/apollographql/apollo-server/tree/main/packages/apollo-server-micro) to provide simple GraphQL server consumed by Next.js app.
Next.js ships with [API routes](https://nextjs.org/docs/api-routes/introduction), which provide an easy solution to build your own `API`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a deployed example of this we can see?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, you'll find this branch deployed on Vercel here: https://api-routes-graphql-yoga.vercel.app/api/graphql?query=%7B%0A++greetings%0A%7D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@charlypoly charlypoly requested a review from leerob April 18, 2022 13:45
ardatan
ardatan previously approved these changes Apr 25, 2022
dotansimha
dotansimha previously approved these changes Apr 26, 2022
@charlypoly charlypoly dismissed stale reviews from dotansimha and ardatan via 658a980 May 23, 2022 08:00
@charlypoly charlypoly requested a review from ijjk May 23, 2022 08:00
ijjk
ijjk previously approved these changes May 23, 2022
Copy link
Member

@ijjk ijjk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kodiakhq kodiakhq bot merged commit 874957e into vercel:canary May 23, 2022
kodiakhq bot pushed a commit that referenced this pull request May 23, 2022
…tNode` and GraphQL Yoga for better DX and smaller bundle size (#36240)

Improve the Next.js with TypeScript + GraphQL example:

- [x] use GraphQL Code Generator instead of `graphql-let`: more widespread tool and smaller bundle size (types only generation vs code generation)
- [x] use GraphQL Yoga instead of Apollo Server Micro: for lighter bundle size as [stated here](#36155)
- [x] introduces GraphQL Code Generator on the API side for Resolvers typing

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants