Hi, I am trying to learn GraphQL and how to use the server side caching but when I import responseCachePlugin and add it to my server I get an error that responseCachePlugin() is not a function. Does anyone know why this is happening? Thank you in advance.
import {ApolloServer, gql} from "apollo-server-express";
import express from 'express';
import http from 'http';
import './models/db.js';
import {typeDefs} from './typeDefs.js';
import {resolvers} from './resolvers.js';
import responseCachePlugin from 'apollo-server-plugin-response-cache';
async function startApolloServer(typeDefs, resolvers){
const app = express();
const httpServer = http.createServer(app);
const server = new ApolloServer({
typeDefs,
resolvers,
cacheControl: true,
corsOptions: {origin: '*'},
plugins: [responseCachePlugin()],
});
await server.start();
server.applyMiddleware({
app,
path: '/graphql'
})
await new Promise(resolve => httpServer.listen({port:4000}, resolve));
console.log(`🚀 Server ready at http://localhost:4000`);
}
startApolloServer(typeDefs, resolvers);