How to use hops-apollo-mock-server - 1 common examples

To help you get started, we’ve selected a few hops-apollo-mock-server 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 xing / hops / packages / apollo-mock-server / lib / mock-server-middleware.js View on Github external
import { ApolloServer } from 'apollo-server-express';
import cookieParser from 'cookie-parser';
import express from 'express';
import hopsConfig from 'hops-config';
// eslint-disable-next-line node/no-extraneous-import
import schema from 'hops-apollo-mock-server/schema';
// eslint-disable-next-line node/no-extraneous-import
import extendContext from 'hops-apollo-mock-server/context-extender';

const apolloAppPromise = Promise.resolve(
  typeof schema === 'function' ? schema() : schema
).then(resolvedSchema => {
  const app = express();

  const server = new ApolloServer({
    schema: resolvedSchema,
    playground: {
      settings: {
        'request.credentials': 'same-origin',
    context: context => extendContext({ ...context, config: hopsConfig }),



Apollo based mock server for Hops

Latest version published 12 months ago

Package Health Score

62 / 100
Full package analysis

Popular hops-apollo-mock-server functions