I\'m trying to figure out an appropriate way of doing authentication, which I know is a touchy subject on the GitHub issue page.
My authentication is simple. I store a
There is no middleware
for no API routes in NextJS
, but there are HOCs, which you can use to connect to db - select the user, etc:
https://hoangvvo.com/blog/nextjs-middleware
Tim from the next chat helped me solve this. Solution can be found here but I will quote him so you all can see:
_app.js
getInitialProps
and redirect like thisI've also created an example skeleton template you can take a look at.