Skip to main content
Deno 2 is finally here 🎉️
Learn more

flash

Flash is a framework to build REST APIs efficiently with Denoflare (Deno + Cloudflare Workers).

⚠️ Do not use Flash for production use yet, unless you are a contributor to the framework.

Usage

Create a worker module file:

// index.ts
import { flash } from "https://deno.land/x/flash/mod.ts";

export default flash({
  "/": "Welcome to flash!",
  // => { message: "Welcome to flash!", status: 200 }

  "/echo/:name": {
    GET: ({ params }) => `${params.name}`,
  },

  "/create": {
    POST: async ({ request }) => {
      const something = await create_something(request.body);
      return {
        message: "Created something in a flash!",
        result: something,
        status: 201,
      };
    },
  },

  404: "404: Not found", // => { message: "Not found", status: 404 }
});

And run with Denoflare!

$ denoflare serve index.ts

Acknowledgment

Development of Flash is supported by Active Connector Inc..