Setup an HTTP server#
Here's an example using GraphQL Yoga:
const { createServer } = require('@graphql-yoga/node')
const typeDefs = require('./graphql/types')
const resolvers = require('./graphql/resolvers')
const { makeExecutableSchema } = require('@graphql-tools/schema')
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; https://www.graphql-yoga.com/docs/features/subscriptions#subscriptions