osrv 0.2.0
osrv: ^0.2.0 copied to clipboard
Unified Dart server runtime for Dart, Node, Bun, Cloudflare, and Vercel.
example/README.md
Example #
This directory contains minimal runnable examples for the officially supported
osrv runtime families.
Included entries:
dart.dartnode.dartbun.dartcloudflare.dartvercel.dart
All entries share the same server.dart definition.
That server only returns:
Hello Osrv!
Dart Runtime #
Run the Dart-hosted example directly from the package root:
dart run example/dart.dart
Node and Bun Runtimes #
The node and bun examples must run on their target JavaScript hosts.
Compile them first:
dart compile js example/node.dart -o example/node.dart.js
dart compile js example/bun.dart -o example/bun.dart.js
Then run them with their matching hosts:
node example/node.dart.js
bun example/bun.dart.js
Fetch-Export Hosts #
Compile the entry to JavaScript, then use the matching shim:
dart compile js example/cloudflare.dart -o example/cloudflare.dart.js
dart compile js example/vercel.dart -o example/vercel.dart.js
The JavaScript shims are:
cloudflare.jsvercel.js
Cloudflare Worker Example #
This directory also includes:
package.jsonwrangler.json
Use them from inside example/:
npm install
npm run build:cloudflare
npm run dev:cloudflare