How to use the fakerest.FetchServer function in fakerest

To help you get started, we’ve selected a few fakerest 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 Kirk-Wang / Blog / react-admin-demo / src / fakeServer / index.ts View on Github external
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();
};
github bootstrap-styled / ra-ui / examples / demo / src / fakeServer / rest.js View on Github external
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();
};
github marmelab / admin-on-rest-demo / src / restServer.js View on Github external
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();
};
github marmelab / react-admin / examples / demo / src / fakeServer / rest.js View on Github external
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();
};

fakerest

Patch XMLHttpRequest to fake a REST server based on JSON data.

MIT
Latest version published 3 months ago

Package Health Score

72 / 100
Full package analysis

Popular fakerest functions

Similar packages