-1

I'm in the middle of making a login system, with nextJS, and Mysql. I wanted to use sessions to login the user, but don't know how to combine express-session with NextJS. My question is, can express-session be used with NextJS, if so how?

Hef
  • 606
  • 6
  • 16

1 Answers1

1

Express-Session is a middleware for Express (it runs on the Express server.)

The best you can do is serve your NextJS application through the Express app, and use the Middleware to handle sessions.

Hope this helps :D

Max
  • 128
  • 5
  • I decided to go with `iron-session`, but I accept this as an answer, as it answers my question. – Hef Sep 18 '22 at 17:30
  • What about if you use it with the [next-connect](https://www.npmjs.com/package/next-connect) library? I am using it that way and it is working. – YulePale May 03 '23 at 06:45