This repository contains multiple libraries to work with Bunny:
With @bunny.net/edgescript-sdk, you can write scripts that run smoothly on Deno, Node, and within the bunny.net network. Below is a quick example to help you get started with setting up a local server. For additional examples and use cases, refer to the examples folder.
import * as BunnySDK from "@bunny.net/edgescript-sdk";
function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
console.log("Starting server...");
BunnySDK.net.http.serve({ port: 8080, hostname: '127.0.0.1' }, async (req) => {
console.log(`[INFO]: ${req.method} - ${req.url}`);
await sleep(1000); // Simulate some processing delay
return new Response("Hello, Bunny Edge!");
});
If you want more information, feel free to dive into each packages to check
associated examples and documentations.