hono-sessions not sharing state between routes.
Hi was just working through hello world login/logout scenario but cannot seem to get the state shared between different routes created in separate files?
6 Replies
Can you post any code of what your tried so we can see
Basically whatever is written to c.get('session').set('something') is not seen by the other routes on redirect.
c.set/get only work between a single route and it’s middleware. Every request made to the server resets all the state. That includes a redirect, that is done by the browser meaning it is a new request
Oh ... right. I though the sessionMiddleware would store state on all '*' routes?
So the middleware will share to all routes. But each route after a return is made and final middleware is ran, context variables are reset. Then they will be created again when that middleware runs
Ok thanks for the help