Chapter 2
Getting Started
Install Hono and run your first local server.
Getting Started
The fastest way to begin a Hono project is with the official starter:
pnpm create hono@latest my-app
For this book, the chosen target is Cloudflare Pages. That gives you local development through Vite and a deployment path for honobook.com.
A minimal Hono app
Every Hono app starts with an application instance and one or more routes:
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => {
return c.text('Hello Hono!')
})
export default app
The c value is Hono's context object. It represents the current request and gives you helpers for building responses.
Local development
Run the development server:
pnpm dev
The Cloudflare Pages template serves the app at http://localhost:5173 during development.