Skip to content

Latest commit

 

History

History
47 lines (30 loc) · 940 Bytes

File metadata and controls

47 lines (30 loc) · 940 Bytes

🔗 Part 2: Integrating Hono Framework

✅ Goals

  • Add the Hono routing framework to simplify route handling
  • Serve static files from a public/ directory

🛠️ Instructions

1. Install Hono

npm install hono

2. Update src/index.ts

Replace your existing handler with this Hono app setup:

import { Hono } from 'hono';

const app = new Hono();

export default app;

3. Update wrangler.jsonc

Ensure your wrangler.jsonc includes the static assets section:

"assets": {
  "directory": "./public",
  "binding": "ASSETS",
}

This tells Cloudflare Workers to bind your./public folder to the ASSETS binding. After adding a binding to wrangler.jsonc you can run npm run cf-typegen to generate types for your bindings.

4. Run the app locally and test:

npm run dev

5. Visit localhost:8787 and you should see your index.html page