© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•17mo ago•
1 reply
jrydberg

Binding outside of the fetch handler?

I got an application I'm porting to cloudflare workers. It has domain services that are instantiated at app start. These services hide underlying storage and other implementation details from the application (ie the API). When an API call comes it, it parses the request and passes it on to a domain service which the handler has a reference to (got injected when the route was set up).

How would I replicate this on Workers where the bindings are given to the fetch handler? Would you bootstrap the app from scratch (ie, creating all domain services, creating the Hono routes that references these services, ...) on every request and then dispatch the request to the hono app?
image.png
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

No fetch handler!
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
8mo ago
Is it possible to access env variables outside "fetch handler"
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
handler does export fetch() function
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
2y ago
Worker binding, fetch to other worker status canceled.
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago