mihaaai
Explore posts from serversIs there a way to get bindings outside the `c` Context of an inbound Request in Cloudflare Workers?
Unfortunatelly it won't work, the lib requires you to export an
auth
object from a auth.ts
file to be able to run the CLI tool for migration against it, if I define the auth
object within a middleware I can't export it and the CLI isn't able to find it.
It also requires me to store another Variable in the context with c.set("auth", auth)
besides the session
and user
already stored in the middleware example to be able to use the handler for the /api/auth/**
routes becoming a strange antipattern.10 replies
Is there a way to get bindings outside the `c` Context of an inbound Request in Cloudflare Workers?
Mmm, not sure this is an optimal way, only imports of
betterAuth
and Kysely
are about half MB of bundle size, again not sure if this is a heavy lift to the whole app, since being it a middleware will execute the setup each time a request comes in, also this lib has handy methods to manage state for Hono, but no reference of D1 Binding within Hono10 replies
Is there a way to get bindings outside the `c` Context of an inbound Request in Cloudflare Workers?
No luck, no matter what I try seems impossible to get a reference of the BIndings, even with the docs about contextStorage() it crashes the app on runtime with
service core:user:app: Uncaught Error: Context is not available
10 replies
How to trigger server function for SSR when transitioning routes?
Thanks for the help, indeed using the slug as an argument to getInitialProps solved the problem, not everything works as expected!
I've been reading about not using the use* functions on the server but damn, the docs are so much empty...
Kudos! 🙏
7 replies
How to trigger server function for SSR when transitioning routes?
NavigatorItem.tsx
This is one of the navigation components that is mounted right inside the <Router>
but not inside the [slug].tsx
page
app.tsx
The Root:
The problem is that getInitialProps()
gets triggered only on full refresh or first load, if I click on <NavigatorItem />
the route changes but the content isn't fetched for the new slug7 replies