nextjs api route request.query is undefined
logs:
I followed the docs and req.query should be
{}
by default but here is undefined
, why?Solution:Jump to solution
If you're using the App Router, the req type is
NextRequest
, or even just simply Request
. query
doesn't exist on the requests from App Router.2 Replies
Solution
If you're using the App Router, the req type is
NextRequest
, or even just simply Request
. query
doesn't exist on the requests from App Router.yep just figured it out, were looking at the wrong docs