'How to change typeDefs and resolvers after startup when using apollo server?
I have hello world code with apollo server:
const startApolloServer = async (typeDefs: any, resolvers: any): Promise<void> => {
const app = express();
const httpServer = http.createServer(app);
const config = {
typeDefs,
resolvers,
// csrfPrevention: true,
plugins: [ApolloServerPluginDrainHttpServer({ httpServer })],
};
const server = new ApolloServer(config);
await server.start();
server.applyMiddleware({ app });
await new Promise<void>(resolve => httpServer.listen({ port: 4000 }, resolve));
console.log(`🚀 Server ready at http://localhost:4000${server.graphqlPath}`);
};
I can set typeDefs and resolvers during the boot proces in my app.
But is there any way how to change schema/resolvers after startup? For example in every request? Or apply some request middleware to resolve schema/resolvers?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
