Cloudflare Durable Objects - how to export classes for durable_objects
bindings?
#1832
-
I am investigating getting nitro working with Cloudflare Durable Objects. In order to do so, you must define bindings in
However, when building with the "cloudflare_module" preset, How do I go about defining these "SomeObject" and "SomeOtherObject" Durable Object classes such that they will be exported as well? Is there a specific directory? A decorator? Preset configuration? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@timhanlon @pi0 I believe both of you have worked on this feature. If you point me in the right direction, I am happy to create a PR with more docs or sample code. Just don't see anything in https://github.com/unjs/nitro/blob/main/src/runtime/entries/cloudflare-module.ts to point me in a useful direction for adding more exports. |
Beta Was this translation helpful? Give feedback.
-
For anyone interested in how this looks, here is the simplest form I could get it to.
That way, all I have to do to add more durable objects is add a new file in And with the Really appreciate the Nitro team (and unjs in general!) for the flexible apis! (Now to see if I can get Cloudflare Durable Objects Websockets working too 😁 ) |
Beta Was this translation helpful? Give feedback.
I dug this out of the Nuxt Discord, worth a shot:
https://discord.com/channels/473401852243869706/897487139888062506/1093592477073670244
https://github.com/nicgene/nuxt-durable-object