DEV Community

Cover image for Building GraphQL Servers in 2022
TheGuildBot for The Guild

Posted on • Edited on • Originally published at the-guild.dev

1

Building GraphQL Servers in 2022

This article was published on Tuesday, June 28, 2022 by Jamie Barton @ The Guild Blog

Building GraphQL servers in 2022 couldn't be any easier thanks to GraphQL Yoga. This year at
HasuraCon
I discussed how Yoga started, how it evolved, and what we can expect from the future.

For many years of building GraphQL servers in the Node ecosystem, our choices have been limited.
Apollo Server library has dominated the ecosystem. With its pairing client library, it was often a
good fit for a very long time. However, I believe there are more mature and battle-tested solutions
available today, thanks to the evolution of Yoga.

GraphQL Yoga takes a different approach by providing enough bells and
whistles that make you production-ready, but builds itself on top of the core primitives of HTTP.
Yoga is runtime agnostic too, so if you're currently working with Cloudflare Workers, Vercel
Functions, AWS Lambda or something else, Yoga will fit right in.

GraphQL Yoga comes with Envelop, and is the recommended way you should be
using Envelop today to extend your GraphQL server.

If you haven't used Yoga before, this is how easy it is to create a production-ready GraphQL server:

import { createServer } from '@graphql-yoga/node'

const server = createServer({
  schema: {
    typeDefs: /* GraphQL */ `
      type Query {
        hello: String
      }
    `,
    resolvers: {
      Query: {
        hello: () => 'Hello from Yoga!'
      }
    }
  }
})

server.start()
Enter fullscreen mode Exit fullscreen mode

If you are interested in following along with me to build a server, add plugins and more, you can
watch the recording of the workshop:

Hopefully you find this talk interesting, and you learn more about building GraphQL severs with
Yoga!

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs