Type Alias NextRouteHandler<ResponseBody, SegmentData>

NextRouteHandler<ResponseBody, SegmentData>: NextRouteHandlerSegmentData extends SegmentData
    ? ((request: NextRequest) => NextResponse<ResponseBody> | PromiseLike<NextResponse<ResponseBody>>)
    : ((request: NextRequest, segmentData: SegmentData) => NextResponse<ResponseBody> | PromiseLike<NextResponse<ResponseBody>>)

A type for representing a Next.js API route handler function. You can provide a type for the response body (or never if there is no response body) and a type for the path parameters object.

The default is to allow any response body, and to have no path parameters.

Type Parameters