• Docs
  • Setup an HTTP Server

Setup an HTTP Server

GraphQL Yoga Example

const { createServer } = require('@graphql-yoga/node')
const { makeExecutableSchema } = require('@graphql-tools/schema')
 
const typeDefs = require('./graphql/types')
const resolvers = require('./graphql/resolvers')
 
const schema = makeExecutableSchema({ typeDefs, resolvers })
const server = createServer({ schema })
 
server.start()

And you can test your queries using built-in GraphiQL:

Adding Subscriptions Support

You can check GraphQL Yoga's dedicated docs for more information about Subscriptions.

Last updated on November 14, 2022