Mock fetch transport middleware.
Answers every exchange with a response computed locally, after an optional simulated latency, so that demos, interactive wireframes and prototypes run on a realistic client without a backend.
Usage
import { createFetch } from "@metreeca/http";import { mock } from "@metreeca/http/mock";const client = createFetch(mock({ serve: request => Response.json({ url: request.url }), delay: 500 })); Copy
import { createFetch } from "@metreeca/http";import { mock } from "@metreeca/http/mock";const client = createFetch(mock({ serve: request => Response.json({ url: request.url }), delay: 500 }));
WHATWG Fetch Standard
Creates a middleware answering exchanges with locally computed responses.
Mock fetch transport middleware.
Answers every exchange with a response computed locally, after an optional simulated latency, so that demos, interactive wireframes and prototypes run on a realistic client without a backend.
Usage
See
WHATWG Fetch Standard