nuxt-session icon indicating copy to clipboard operation
nuxt-session copied to clipboard

Ensure that session middleware is always first

Open BracketJohn opened this issue 3 years ago • 0 comments

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-L86

This 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 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)

Additional information

No response

BracketJohn avatar Nov 27 '22 14:11 BracketJohn