79213533

Date: 2024-11-22 03:29:49
Score: 3
Natty:
Report link
import { type NextRequest } from 'next/server'
 
export function GET(request: NextRequest) {
  const searchParams = request.nextUrl.searchParams
  const query = searchParams.get('query')
  // query is "hello" for /api/search?query=hello
}

I found this link
https://nextjs.org/docs/app/building-your-application/routing/route-handlers#url-query-parameters
which can solve your problem.

Reasons:
  • Blacklisted phrase (1): this link
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: liuchen