You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've found severals ways of doing middleware with Nextjs eg:
But out of my curiousity, may I know is there a possible way to do middleware using Dynamic API Routes methods?
eg:
Recently I came across with a cool nextjs auth package: (https://next-auth.js.org/getting-started/example)
I've studied the source and try with below codes on pages/api/[...middleware].js
Ideally when i try to fetch the url:
http://localhost:3000/api/auth/user
the terminal/console should output following console eg:
May I know what did i miss?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions