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
brew install fastly/tap/fastly
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.
txt
npm create hono@latest my-app
npm create hono@latest my-app
txt
yarn create hono my-app
yarn create hono my-app
txt
pnpm create hono my-app
pnpm create hono my-app
txt
bunx create-hono my-app
bunx create-hono my-app
txt
deno run -A npm:create-hono my-app
deno run -A npm:create-hono my-app
Move to my-app
and install the dependencies.
txt
cd my-app
npm i
cd my-app
npm i
txt
cd my-app
yarn
cd my-app
yarn
txt
cd my-app
pnpm i
cd my-app
pnpm i
txt
cd my-app
bun i
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()
// 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.
txt
npm run dev
npm run dev
txt
yarn dev
yarn dev
txt
pnpm dev
pnpm dev
txt
bun run dev
bun run dev
4. Deploy
txt
npm run deploy
npm run deploy
txt
yarn deploy
yarn deploy
txt
pnpm deploy
pnpm deploy
txt
bun run deploy
bun run deploy
That's all!!