Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 && layer.route.path && layer.route.path === '*') {
app._router.stack.splice(routeIndex, 1);
break;
}
}
// ================================= dyson mock setup
}
},
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 && layer.route.path && layer.route.path === '*') {
app._router.stack.splice(routeIndex, 1);
break;
}
}
// ================================= dyson mock setup