Last active
August 13, 2025 08:29
-
-
Save MehmetAdemi/4ddefd93123d718cbfdbc3190d2e8434 to your computer and use it in GitHub Desktop.
Next.js App Router - Backend caption route in the Remotion Editor Starter (https://remotion.dev/docs/editor-starter/backend-routes)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // src/app/api/font/[name]/route.ts | |
| // Font loading and management | |
| import {NextRequest, NextResponse} from 'next/server'; | |
| import {GOOGLE_FONTS_DATABASE} from '@/editor/data/google-fonts'; | |
| interface RouteParams { | |
| params: { | |
| name: string; | |
| }; | |
| } | |
| export async function GET(request: NextRequest, {params}: RouteParams) { | |
| const { name } = await params | |
| const entry = GOOGLE_FONTS_DATABASE.find( | |
| (font) => font.fontFamily === name, | |
| ); | |
| if (!entry) { | |
| return new NextResponse('Font not found', { | |
| status: 404, | |
| }); | |
| } | |
| return NextResponse.json(entry, { | |
| status: 200, | |
| headers: {'Content-Type': 'application/json'}, | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment