Closed
Description
I still don't get about universal middleware.
I have code like this using hono
export const preference = (): MiddlewareHandler => {
return async function preference(c, next) {
const cookiePreference = getCookie(c, "preference")
const preference = cookiePreference
? JSON.parse(cookiePreference)
: PREFERENCE
c.set("preference", preference)
await next()
}
}
export const ssr = () =>
vikeNode({
pageContext: (c: Context) => {
return {
preference: c.var.preference,
user: c.var.user,
vendor: c.var.vendor,
}
},
static: {
root: distClient,
},
})
instance.use(preference())
instance.use(ssr())
And with universal-middleware, can I still use hono context using native behavior like c.var
and c.set
?
Metadata
Assignees
Labels
No labels