Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Cloudflare Workers environment and execution context #673

Open
tadhglewis opened this issue Sep 11, 2024 · 2 comments
Open

Support Cloudflare Workers environment and execution context #673

tadhglewis opened this issue Sep 11, 2024 · 2 comments
Labels
needs investigation Something that needs to be looked at suggestion A suggestion

Comments

@tadhglewis
Copy link

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

@kitsonk kitsonk added needs investigation Something that needs to be looked at suggestion A suggestion labels Sep 13, 2024
@kitsonk
Copy link
Collaborator

kitsonk commented Sep 13, 2024

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.

@tadhglewis
Copy link
Author

tadhglewis commented Sep 15, 2024

@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
Labels
needs investigation Something that needs to be looked at suggestion A suggestion
Projects
None yet
Development

No branches or pull requests

2 participants