How do you get query params in Next13, app router w/ route.ts file?

https://nextjs.org/docs/app/api-reference/file-conventions/route#parameters I am unsure of how you are meant to the get queryParams on the server site /api/route.ts file? I can find no mention of it? I am using the /app router and on the req: NextRequest parameter there is no req.query etc.
File Conventions: route.js
API reference for the route.js special file.
1 Reply
JacobParis
JacobParis16mo ago
query params are part of the URL
const url = new URL(request.url)
url.searchParams.get("q")
const url = new URL(request.url)
url.searchParams.get("q")
Want results from more Discord servers?
Add your server