Global ContextHolder
I'm using Hono on cloudflare workers and my handle functions look like:
and I'm then passing that
ctx
that to other method calls in multiple layers.
which feels quite cumbersome.
is it possible to create some global ContextHolder
where I can set and get the ctx
from? Like a request-scoped holder...
I wonder how others do this?2 Replies
Cloudflare Docs
AsyncLocalStorage | Cloudflare Workers docs
Cloudflare Workers provides an implementation of a subset of the Node.js AsyncLocalStorage API for creating in-memory stores that remain coherent through asynchronous operations.
Ah cool . Did not now AsyncLocalStorage was supported 👍