Skip to main content
import * as BunnySDK from "https://esm.sh/@bunny.net/[email protected]";

BunnySDK.net.http.serve(
  async (request: Request): Response | Promise<Response> => {
    const url = new URL(request.url);
    if (request.method !== "GET")
      return new Response("Not Allowed", {
        status: 405,
        headers: {
          Allow: "GET",
        },
      });

    const responseObj = {
      hello: "world",
    };

    return new Response(JSON.stringify(responseObj), {
      headers: {
        "Content-type": "application/json",
      },
    });
  },
);