The thing is return apiResolver(req, res, undefined, handler); 3rd arg is query params so if you have a route /api/posts/:id inside Next.js controller req.query.id will not be passed and will be hardcoded undefined. Do you know how to pass api dynamic route params?
The thing is
return apiResolver(req, res, undefined, handler);
3rd arg is query params so if you have a route/api/posts/:id
inside Next.js controllerreq.query.id
will not be passed and will be hardcodedundefined
. Do you know how to pass api dynamic route params?You're right, you can extract it from
req
with the help of theqs
(query string) package if it needs specific formatting.Have a look here: nodejs.org/en/knowledge/HTTP/clien... :)