From b953af39e33eae513984a9c9bac15df8a126abed Mon Sep 17 00:00:00 2001 From: Armaan A <49625265+Armster15@users.noreply.github.com> Date: Sun, 7 Apr 2024 15:43:32 -0700 Subject: [PATCH] Update Vercel page (#297) * add typescript type to next api route `config` object * disable bodyParser in next api route when running on node js See https://github.com/honojs/node-server/issues/84 Based on manual testing, this only affects the Node js runtime on the pages router: the app router as a whole and edge API routes in the pages router are unaffected. --- getting-started/vercel.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/getting-started/vercel.md b/getting-started/vercel.md index 563563a4..2ea8244e 100644 --- a/getting-started/vercel.md +++ b/getting-started/vercel.md @@ -90,10 +90,11 @@ If you use the Pages Router, Edit `pages/api/[[...route]].ts`. ```ts import { Hono } from 'hono' import { handle } from 'hono/vercel' +import type { PageConfig } from 'next' -export const config = { +export const config: PageConfig = { runtime: "edge", -}; +} const app = new Hono().basePath("/api") @@ -151,8 +152,13 @@ Next, you can utilize the `handle` function imported from `@hono/node-server/ver ```ts import { Hono } from 'hono' import { handle } from '@hono/node-server/vercel' +import type { PageConfig } from 'next' - +export const config: PageConfig = { + api: { + bodyParser: false, + }, +} const app = new Hono().basePath('/api')