How to use the miragejs.Server function in miragejs

To help you get started, we’ve selected a few miragejs 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 gitlabhq / gitlabhq / spec / frontend_integration / test_helpers / mock_server / index.js View on Github external
export const createMockServer = () => {
  const server = new Server(createMockServerOptions());

  return server;
};
github sanger / sequencescape / app / javascript / plate-picks / _mirage_ / index.js View on Github external
export function startMirage() {
  return new Server({
    trackRequests: true,
    environment: 'test',
    namespace: 'plate_picks',
    models: {
      plate: Model,
      batch: Model,
    },

    routes() {
      this.get('plates/:barcode', (schema, request) => {
        return schema.plates.findBy({ barcode: request.params.barcode })
      })
      this.resource('batches')
    },
  })
}

miragejs

A client-side server to help you build, test and demo your JavaScript app

MIT
Latest version published 1 month ago

Package Health Score

89 / 100
Full package analysis