Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const fakeServer = () => {
const data = generateData({ serializeDate: true });
const restServer = new FakeRest.FetchServer("http://api.fakeserver.com");
if (window) {
window.restServer = restServer; // give way to update data in the console
}
restServer.init(data);
restServer.toggleLogging(); // logging is off by default, enable it
fetchMock.mock("begin:http://api.fakeserver.com", restServer.getHandler());
return () => fetchMock.restore();
};
export default () => {
const data = generateData({ serializeDate: true });
const restServer = new FakeRest.FetchServer('http://localhost:4000');
if (window) {
window.restServer = restServer; // give way to update data in the console
}
restServer.init(data);
restServer.toggleLogging(); // logging is off by default, enable it
fetchMock.mock('begin:http://localhost:4000', restServer.getHandler());
return () => fetchMock.restore();
};
export default () => {
const restServer = new FakeRest.FetchServer('http://localhost:3000');
restServer.init(data);
restServer.toggleLogging(); // logging is off by default, enable it
fetchMock.mock('^http://localhost:3000', restServer.getHandler());
return () => fetchMock.restore();
};
export default () => {
const data = generateData({ serializeDate: true });
const restServer = new FakeRest.FetchServer('http://localhost:4000');
if (window) {
window.restServer = restServer; // give way to update data in the console
}
restServer.init(data);
restServer.toggleLogging(); // logging is off by default, enable it
fetchMock.mock('begin:http://localhost:4000', restServer.getHandler());
return () => fetchMock.restore();
};