After you initialize GraphQLServer, you have to createHttpServer instead of starting the server, and then you can use the express instance on firebase functions.
const { GraphQLServer } = require('graphql-yoga');
const functions = require('firebase-functions');
const typeDefs = `
type Query {
hello(name: String): String!
}
`;
const resolvers = {
Query: {
hello: (_, { name }) => `Hello ${name || 'World'}`,
},
};
const server = new GraphQLServer({ typeDefs, resolvers });
const options = {
cors: true,
};
server.createHttpServer(options);
const express = server.express
module.exports = {
yoga: functions.https.onRequest(express),
};
Due to inactivity of this issue we have marked it stale. It will be closed if no further activity occurs.
Hey :wave:, It seems like this issue has been inactive for some time. In need for maintaining clear overview of the issues concerning the latest version of graphql-yoga we'll close it.
Feel free to reopen it at any time if you believe we should futher discuss its content. :slightly_smiling_face:
Most helpful comment
After you initialize
GraphQLServer, you have tocreateHttpServerinstead of starting the server, and then you can use the express instance on firebase functions.