diff --git a/src/app/(public)/links/route.ts b/src/app/(public)/l/route.ts similarity index 90% rename from src/app/(public)/links/route.ts rename to src/app/(public)/l/route.ts index a69159a..20d15b9 100644 --- a/src/app/(public)/links/route.ts +++ b/src/app/(public)/l/route.ts @@ -12,15 +12,15 @@ import type { LinkMeta } from '@/lib/types/meta'; export async function POST( request: Request ): Promise>> { - try { - const body = (await request.json().catch(() => null)) as Link | null; + const body = (await request.json().catch(() => null)) as Link | null; - if (!body) - return NextResponse.json( - { message: 'Invalid request body' }, - { status: 400 } - ); + if (!body) + return NextResponse.json( + { message: 'Invalid request body' }, + { status: 400 } + ); + try { const { url, slug } = linkSchema.parse(body); const isValidUrl = checkIfUrlIsValid(url); diff --git a/src/app/actions.ts b/src/app/actions.ts index 5834ceb..95f6fdc 100644 --- a/src/app/actions.ts +++ b/src/app/actions.ts @@ -15,7 +15,7 @@ export async function createLink( let successUrl: string; try { - const response = await fetch(`${NEXT_PUBLIC_URL}/links`, { + const response = await fetch(`${NEXT_PUBLIC_URL}/l`, { method: 'POST', headers: { Origin: NEXT_PUBLIC_URL, diff --git a/src/middleware.ts b/src/middleware.ts index 45ee678..6689854 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -49,5 +49,5 @@ type Config = { }; export const config: Config = { - matcher: '/links' + matcher: '/l' };