This content originally appeared on Bram.us and was authored by Bramus!
Miniflare is a simulator for developing and testing Cloudflare Workers.
Originally started as an open-source project, Miniflare has been adopted by Cloudflare to become part of their ecosystem.
Installation per NPM:
npm install -g miniflare
CLI usage is really simple, and is highly configurable using one of its many flags:
$ miniflare worker.js
[mf:inf] Worker reloaded! (97B)
[mf:inf] Listening on :8787
[mf:inf] - http://127.0.0.1:8787
Alternatively you can also use it in your own JS code:
import { Miniflare } from "miniflare";
const mf = new Miniflare({
script: `
addEventListener("fetch", (event) => {
event.respondWith(new Response("Hello Miniflare!"));
});
`,
});
const res = await mf.dispatchFetch("http://localhost:8787/");
console.log(await res.text()); // Hello Miniflare!
This content originally appeared on Bram.us and was authored by Bramus!

Bramus! | Sciencx (2021-09-27T21:15:21+00:00) Miniflare — Fully-local simulator for Cloudflare Workers. Retrieved from https://www.scien.cx/2021/09/27/miniflare-fully-local-simulator-for-cloudflare-workers/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.