I came to nextJS 9.0 . I happy easy to use API And Client Together. but I want to move external API into NEXTJS project (page/api) Graphql workfine. but External API Keep IP and location in middleware.
I use lib external API below.
request-ip
express-ip
PS.graphql I use apollo-server-micro and I pass bodyParser:off in graphql

this way, you could have another file to define the express() and use some common middlewares
We'll be adding a helper for middleware soon.
Adding express will greatly reduce performance of the API endpoint. But I'm going to close this issue as it ignored the issue template.
@timneutkens – Is there an active PR or RFC for the middleware helper you mentioned? I'd be happy to contribute if help is welcome.
For anyone in the future looking for this feature, what you need is probably API Routes.
There's a really good resource here.
Most helpful comment
@timneutkens – Is there an active PR or RFC for the middleware helper you mentioned? I'd be happy to contribute if help is welcome.