This commit is contained in:
2025-09-30 17:12:14 +08:00
parent 766694c1a3
commit d22979eae2
5 changed files with 145 additions and 0 deletions

14
src/app/api/ipa/route.ts Normal file
View File

@@ -0,0 +1,14 @@
import { getIPA } from "@/utils";
import { NextRequest, NextResponse } from "next/server";
export async function GET(request: NextRequest) {
const searchParams = request.nextUrl.searchParams;
const text = searchParams.get('text');
if (!text) return NextResponse.json({ 'error': 400 }, { status: 400 });
const r = await getIPA(text);
if (r === null) return NextResponse.json({ 'error': 424 }, { status: 424 });
return NextResponse.json({ r }, { status: 200 });
}