chore: refactor apiRouteMiddleware and add it to some api routes in App Router (#19146)

* chore: remove try and catch from api routes in app router

* refactor

* refactor apiRouteMiddleware

* refactor
This commit is contained in:
Benny Joo authored and GitHub committed 2025-02-07 11:04:34 +00:00
1 parent 24a080b988
commit e79af63e6c
6 files changed
+127 -156

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ import { NextResponse } from "next/server";
import { getServerErrorFromUnknown } from "./getServerErrorFromUnknown";
export const apiRouteMiddleware =
(handler: (req: Request, res?: Response) => Promise<Response>) =>
(handler: (req: NextRequest, res?: NextResponse) => Promise<NextResponse>) =>
async (req: NextRequest, res: NextResponse) => {
try {
return await handler(req, res);