The function that handles the request logic.
A handler for Next.js API routes.
Main request handler.
The incoming NextRequest object.
Additional context, such as route parameters.
A Next.js Response object.
Adds authorization logic to the request handler.
A function to check the token's validity.
A handler with authorization.
Wrapper function to handle API route logic with error handling and context preparation.