Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const ApolloClient = require('apollo-boost').ApolloClient;
const createHttpLink = require('apollo-link-http').createHttpLink;
const fetch = require('cross-fetch/polyfill').fetch;
const fs = require('fs-extra');
const { gql } = require('apollo-server-express');
const InMemoryCache = require('apollo-cache-inmemory').InMemoryCache;
const path = require('path');
/* Extract cache server-side */
module.exports = async (req, { publicDir }) => {
let cache = '';
return new Promise(async(resolve, reject) => {
try {
const client = new ApolloClient({
link: createHttpLink({
uri: 'http://localhost:4000?q=internal', /* specific internal flag to prevent looping cache on request */
fetch: fetch
}),