Skip to content

Support Cloudflare Workers environment and execution context #673

Open

Description

@tadhglewis

It'd be great to have Oak feature parity with Hono so I can use it!

Specifically,

Cloudflare Worker environment and execution context are not currently exposed to middleware.

This means you're not able to access things like environment variables and bindings.

Hono supports this quite well https://hono.dev/docs/getting-started/cloudflare-workers#bindings

Hono also supports things like Cloudflare Queues which has a nice API. https://hono.dev/examples/cloudflare-queue

Activity

  1. kitsonk commented on Sep 13, 2024

    @kitsonk
    Member

    I have looked at it previously, and given the structure of oak it would require a lot of rework and changes.

    That being said, it is supported on acorn, which is a more focused framework for creating services and specifically caters to Cloudflare Workers and providing access to environment context in a consistent way across whatever runtime.

    There isn't anything specifically acorn would need to do to support the example you provided like Hono, as there isn't any specific support outside required in addition to providing access to the environment context, which works exactly like it does in Hono.

    Back-porting the support from acorn into oak is a possibility, and I will take a look at that.

  2. tadhglewis commented on Sep 15, 2024

    @tadhglewis
    Author

    @kitsonk I did have a look at acorn however I was put off by "focused framework for creating RESTful JSON services" however I'll take a better look.

    It'd be great to have a comparison table between Oak and Acorn (and Hono). I'm a big fan of Koa as I want a simple/flexible unopinionated framework. On the surface, Acorn seems to be a RESTful opinionated spinoff of Oak? Or is it an Oak replacement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions