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/fastly
Follow 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-app
sh
yarn create hono my-app
sh
pnpm create hono my-app
sh
bunx create-hono my-app
sh
deno init --npm hono my-app
Move to my-app
and install the dependencies.
sh
cd my-app
npm i
sh
cd my-app
yarn
sh
cd my-app
pnpm i
sh
cd my-app
bun i
3. 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 dev
sh
yarn dev
sh
pnpm dev
sh
bun run dev
4. Deploy
sh
npm run deploy
sh
yarn deploy
sh
pnpm deploy
sh
bun run deploy
That's all!!