Skip to content

Commit

Permalink
🐛 fix: fix edge error
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Aug 17, 2023
1 parent e0994fa commit c3c798d
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions api/v1/index.ts
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit c3c798d

Please sign in to comment.