The Guild LogoThe Guild Monogram
Docs

Yoga

Fully-featured, simple to set up, performant and extendable GraphQL JavaScript server

Get Started

Integration with nextjs#

Next.js is a web framework that allows you to build websites very quickly and GraphQL Yoga can be integrated with Next.js easily as an API Route.

Installation#

yarn add graphql yarn add @graphql-yoga/node

Example#

pages/api/graphql.ts

// Next.js API route support: https://nextjs.org/docs/api-routes/introduction import { createServer } from '@graphql-yoga/node' import { NextApiRequest, NextApiResponse } from 'next' const server = createServer<{ req: NextApiRequest res: NextApiResponse }>() export default server

You can also check a full example on our GitHub repository here