Setup an HTTP Server
GraphQL Yoga Example
import { createSchema, createYoga } from 'graphql-yoga';
import { createServer } from 'http'
const typeDefs = require('./graphql/types')
const resolvers = require('./graphql/resolvers')
createServer(
createYoga({ schema: createSchema({ typeDefs, resolvers })
).listen(4000, () => {
console.log('GraphQL Server is listening on http://localhost:4000/graphql');
})
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.