Nuxt session middleware to get a persistent session per app user, e.g., to store data across multiple requests. The nuxt session module provides the useSession() composable out of the box and sets up API endpoints to interact with your session to make working with sessions feel like a breeze.
With further investigation this does not work, as the module setup runs at "build time" before the user nuxt app, so at that point any user middlewares are not in the middleware array yet, so unshifting does not have any effect.
Goal:
[ ] always register session middleware first
with reasonable precision
[ ] optional: allow user to set order (this could be helpful with other modules that should come before / after this session middleware)
Describe the feature
Currently, we attempt to ensure that the server session middleware is always first by using
.unshit
to register it: https://github.com/sidebase/nuxt-session/blob/f82d2c110f081d82de396e925e6b18f694ada8dd/src/module.ts#L80-L86This attempt however does not work, as noticed by discord user Bark: https://discord.com/channels/1024643779711483944/1024705710455533598/1045816936359010326
With further investigation this does not work, as the module setup runs at "build time" before the user nuxt app, so at that point any user middlewares are not in the middleware array yet, so
unshift
ing does not have any effect.Goal:
Additional information
No response