diff --git a/api/v1/index.ts b/api/v1/index.ts index b0edaf4..a27bc4b 100644 --- a/api/v1/index.ts +++ b/api/v1/index.ts @@ -1,15 +1,13 @@ -import fetchContent from './_utils'; - -export const config = { - runtime: 'edge', -}; +import type { VercelRequest, VercelResponse } from '@vercel/node'; -export default async (req: Request) => { - if (req.method !== 'POST') return new Response('Method Not Allowed', { status: 405 }); +import fetchContent from './_utils'; - const args = (await req.json()) as { url: string }; +export default async function handler(req: VercelRequest, res: VercelResponse) { + if (req.method !== 'POST') { + res.status(405); + } - const result = await fetchContent(args); + const result = await fetchContent(req.body); - return new Response(JSON.stringify(result)); -}; + res.send(result); +}