#Get search params

1 messages · Page 1 of 1 (latest)

wary knollBOT
#

Hi @ornate quail. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To access URL search parameters in Next.js, you should use the get method of the searchParams object. In your case, if you want to access the folder parameter, you should do it like this:

export async function GET(request, context) {
  const folder = request.nextUrl.searchParams.get('folder');
  console.log(folder);
}

This will return the value of the folder parameter if it exists, or null if it doesn't.

For more information, you can refer to the Next.js documentation on useSearchParams (https://nextjs.org/docs/app/api-reference/functions/use-search-params).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: