I have an express middleware that has some api routes.
My middleware serves these pages if they match the glob. If it doesn't find a match it injects some user session data into the request object.
Is it possible to configure nextjs using next-connect in a way which will allow me to not handle a request but inject the data into it so that the same request can be handled by one of the pages?
Basically some sort of a middleware which runs before api and pages.
Yes, I think you are referring req.use (https://github.com/hoangvvo/next-connect#usebase-fn). If that is not what you meant, can you provide some code snippet to illustrate what you are trying to achieve? Thanks!
Hi,
I have an express middleware that has some api routes.
My middleware serves these pages if they match the glob. If it doesn't find a match it injects some user session data into the request object.
Is it possible to configure nextjs using next-connect in a way which will allow me to not handle a request but inject the data into it so that the same request can be handled by one of the pages?
Basically some sort of a middleware which runs before api and pages.
Thanks for any help
Vishal