How to use the fusion-react/dist function in fusion-react

To help you get started, we’ve selected a few fusion-react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fusionjs / fusionjs / fusion-plugin-apollo / src / __tests__ / integration.node.js View on Github external
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);
github fusionjs / fusionjs / fusion-plugin-apollo / src / __tests__ / server.node.js View on Github external
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;
}

fusion-react

FusionJS entry point for React universal rendering

MIT
Latest version published 1 year ago

Package Health Score

60 / 100
Full package analysis

Similar packages