Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function testApp(el, {typeDefs, resolvers}, enhanceApp) {
const port = await getPort();
const endpoint = `http://localhost:${port}/graphql`;
const app = new App(el);
const schema = makeExecutableSchema({typeDefs, resolvers});
const client = new ApolloClient({
cache: new InMemoryCache({
addTypename: false,
}).restore({}),
link: new HttpLink({
endpoint,
fetch: async (url, options) => {
// required since the url here is only the path
const result = await fetch(endpoint, options);
return result;
},
}),
});
app.enhance(RenderToken, ApolloRenderEnhancer);
app.register(GraphQLSchemaToken, schema);
function testApp(el, {typeDefs, resolvers}) {
const app = new App(el);
const schema = makeExecutableSchema({typeDefs, resolvers});
app.register(RenderToken, plugin);
app.register(GraphQLSchemaToken, schema);
app.register(ApolloClientToken, ctx => {
return new ApolloClient({
ssrMode: true,
cache: new InMemoryCache().restore({}),
link: new SchemaLink({
schema,
context: ctx,
}),
});
});
return app;
}