Fastly Compute
Fastly's Compute offering allows us to build high scale, globally distributed applications and execute code at the edge of Fastly CDN.
Hono also works on Fastly Compute.
1. Install CLI
To use Fastly Compute, you must create a Fastly account if you don't already have one. Then, install Fastly CLI.
macOS
sh
brew install fastly/tap/fastlyFollow this link for other OS:
2. Setup
A starter for Fastly Compute is available. Start your project with "create-hono" command. Select fastly template for this example.
sh
npm create hono@latest my-appsh
yarn create hono my-appsh
pnpm create hono my-appsh
bunx create-hono my-appsh
deno run -A npm:create-hono my-appMove to my-app and install the dependencies.
sh
cd my-app
npm ish
cd my-app
yarnsh
cd my-app
pnpm ish
cd my-app
bun i3. Hello World
Edit src/index.ts:
ts
// src/index.ts
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hello Fastly!'))
app.fire()4. Run
Run the development server locally. Then, access http://localhost:7676 in your Web browser.
sh
npm run devsh
yarn devsh
pnpm devsh
bun run dev4. Deploy
sh
npm run deploysh
yarn deploysh
pnpm deploysh
bun run deployThat's all!!
