How to use the dyson.getConfigurations function in dyson

To help you get started, we’ve selected a few dyson 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 okta / okta-signin-widget / webpack.playground.config.js View on Github external
before (app) {
      app.get('/app/UserHome', (req, res) => {
        res.status(200)
          .send('<h1>Mock User Dashboard</h1><a href="/">Back to Login</a>');
      });

      // ================================= dyson mock setup
      const mockOptions = {
        multiRequest: false,
        proxy: false,
        configDir: `${PLAYGROUND}/mocks`,
      };
      dyson.registerServices(
        app,
        mockOptions,
        dyson.getConfigurations(mockOptions),
      );
      // dyson register '*' route explicitly, that leads to multiple "*" routes. We need to remove "*" route
      // added by dyson from router stack and keep the one which was added by webpack dev server.
      let routeIndex = app._router.stack.length;
      while (routeIndex) {
        routeIndex -= 1;
        const layer = app._router.stack[routeIndex];
        if (layer.route &amp;&amp; layer.route.path &amp;&amp; layer.route.path === '*') {
          app._router.stack.splice(routeIndex, 1);
          break;
        }
      }
      // ================================= dyson mock setup
    }
  },

dyson

Node server for dynamic, fake JSON.

MIT
Latest version published 4 years ago

Package Health Score

45 / 100
Full package analysis