Vercel
Vercel is the AI cloud, providing the developer tools and cloud infrastructure to build, scale, and secure a faster, more personalized web.
Hono can be deployed to Vercel with zero-configuration.
1. セットアップ
Vercel 向けのスターターもあります。 "create-hono" コマンドで始めましょう。 vercel テンプレートを選択します。
sh
npm create hono@latest my-appsh
yarn create hono my-appsh
pnpm create hono my-appsh
bun create hono@latest my-appsh
deno init --npm hono my-appmy-app に移動し、依存関係をインストールします。
sh
cd my-app
npm ish
cd my-app
yarnsh
cd my-app
pnpm ish
cd my-app
bun iWe will use Vercel CLI to work on the app locally in the next step. If you haven't already, install it globally following the Vercel CLI documentation.
2. Hello World
In the index.ts or src/index.ts of your project, export the Hono application as a default export.
ts
import { Hono } from 'hono'
const app = new Hono()
const welcomeStrings = [
'Hello Hono!',
'To learn more about Hono on Vercel, visit https://vercel.com/docs/frameworks/hono',
]
app.get('/', (c) => {
return c.text(welcomeStrings.join('\n\n'))
})
export default appIf you started with the vercel template, this is already set up for you.
3. Run
To run the development server locally:
sh
vercel devVisiting localhost:3000 will respond with a text response.
4. デプロイ
Deploy to Vercel using vc deploy.
sh
vercel deploy