Hono
Documentation
Quickstart
Installation
npm create --yes hono@latest my-app# For the `Which template do you want to use?` prompt, select `nodejs`cd my-appnpm uninstall @hono/node-server
Configuration
The docs explain how to use the SSG Helper to generate a static site from your Hono application.
Update the template to export the Hono app and remove @hono/node-server code:
src/index.ts
import { serve } from '@hono/node-server'import { Hono } from 'hono'const app = new Hono()app.get('/', (c) => { return c.text('Hello Hono!') return c.html('Hello Hono!') })const port = 3000console.log(`Server is running on port ${port}`)serve({ fetch: app.fetch, port,})export default app
Create a build script:
src/build.ts
import app from './index'import { toSSG } from 'hono/ssg'import fs from 'fs/promises'fs.rm('./static', { recursive: true, force: true }).then(() => toSSG(app, fs))
Note how Hono generates files and treats trailing slashes.
Hono supports middleware to define parameterized routes with ssgParams. Middleware supports options for disableSSG and onlySSG too.
Deployment
Build
npx tsx src/build
Preview
npx --yes serve@latest static
Deploy
npx --yes bunny-launcher@latest --interactive