hoangvvo / next-connect

The TypeScript-ready, minimal router and middleware layer for Next.js, Micro, Vercel, or Node.js http/http2
https://www.npmjs.com/package/next-connect
MIT License
1.64k stars 65 forks source link

Add support vs `getInitialProps` or document middleware #4

Closed hoangvvo closed 4 years ago

hoangvvo commented 4 years ago

Currently, next-connect works with API Routes only.

We need to add support for getInitialProps or better yet document middleware (https://github.com/zeit/next.js/issues/7208). They both share the same PageContext and can be implemented with one same approach.

Current implementation of nextConnect() returns a function with two argument. It is possible to approach it with withMiddleware() or useMiddleware() as in next-session.