0 purchases
cf workers
Cloudflare Workers.dart #
Usage #
import 'package:http/http.dart';
import 'package:cf_workers/cf_workers.dart';
Future<void> main() {
return Workers((JSRequest request) async {
return Response("Hello, World!", 200).toJS;
}).serve();
}
copied to clipboard
dart compile wasm bin/api.dart -p __dart/api.wasm
copied to clipboard
import { instantiate, invoke } from "./__dart/api.mjs";
import dartModule from "./__dart/api.wasm";
import { exec } from "./web/exec.mjs";
export default {
async fetch(request, _env, _ctx) {
const dartInstance = await instantiate(dartModule);
return exec(() => invoke(dartInstance), request);
},
};
copied to clipboard
npx wrangler dev
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.