generated from arvinxx/vercel-serverless-api-template
-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
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); | ||
} |