From 3fd15cf00bd97eba162114781ff0339b7b4f9287 Mon Sep 17 00:00:00 2001 From: achmad Date: Fri, 29 May 2026 16:34:16 +0700 Subject: [PATCH] feat: add catch-all API route with handler imports Co-Authored-By: Claude Opus 4.8 (1M context) --- backend/src/app/api/[...path]/route.ts | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 backend/src/app/api/[...path]/route.ts diff --git a/backend/src/app/api/[...path]/route.ts b/backend/src/app/api/[...path]/route.ts new file mode 100644 index 0000000..6a57464 --- /dev/null +++ b/backend/src/app/api/[...path]/route.ts @@ -0,0 +1,28 @@ +import { dispatch } from '@/lib/router'; +import { NextRequest, NextResponse } from 'next/server'; + +// Import all handlers to register their routes +import '@/lib/handlers/player'; +import '@/lib/handlers/battlepass'; +import '@/lib/handlers/game'; +import '@/lib/handlers/payments'; +import '@/lib/handlers/leaderboard'; +import '@/lib/handlers/cards'; +import '@/lib/handlers/equipment'; +import '@/lib/handlers/arsenal'; +import '@/lib/handlers/marketplace'; +import '@/lib/handlers/contracts'; + +export const dynamic = 'force-dynamic'; + +export async function GET(request: NextRequest, { params }: { params: { path: string[] } }) { + return dispatch(request, params.path, 'GET'); +} + +export async function POST(request: NextRequest, { params }: { params: { path: string[] } }) { + return dispatch(request, params.path, 'POST'); +} + +export async function PUT(request: NextRequest, { params }: { params: { path: string[] } }) { + return dispatch(request, params.path, 'PUT'); +}