mirror of
https://github.com/cloudflare/workers-rs.git
synced 2025-12-08 18:01:59 +00:00
25 lines
596 B
TypeScript
25 lines
596 B
TypeScript
import { Miniflare } from "miniflare";
|
|
import { createServer } from "net";
|
|
|
|
export const server = createServer(function (socket) {
|
|
socket.on('data', function (data) {
|
|
socket.write(data, (err) => {
|
|
console.error(err);
|
|
});
|
|
});
|
|
}).listen(8080);
|
|
|
|
export const mf = new Miniflare({
|
|
scriptPath: "./build/index.js",
|
|
compatibilityDate: "2024-12-05",
|
|
modules: true,
|
|
modulesRules: [
|
|
{ type: "CompiledWasm", include: ["**/*.wasm"], fallthrough: true },
|
|
],
|
|
outboundService: {
|
|
network: { allow: ["local"] }
|
|
}
|
|
});
|
|
|
|
export const mfUrl = await mf.ready;
|