Skip to content

Fastly Compute

Fastly Compute is an advanced edge computing system that runs your code, in your favorite language, on our global edge network. Hono also works on Fastly Compute.

You can develop the application locally and publish it with a few commands using Fastly CLI.

1. Setup

スターターは Fastly Compute でも使用できます。 "create-hono" コマンドでプロジェクトを開始しましょう。 fastly テンプレートを選択します。

sh
npm create hono@latest my-app
sh
yarn create hono my-app
sh
pnpm create hono my-app
sh
bun create hono@latest my-app
sh
deno init --npm hono my-app

my-app に移動して依存関係をインストールします。

sh
cd my-app
npm i
sh
cd my-app
yarn
sh
cd my-app
pnpm i
sh
cd my-app
bun i

2. Hello World

src/index.ts を変更します:

ts
// src/index.ts
import { Hono } from 'hono'
const app = new Hono()

app.get('/', (c) => c.text('Hello Fastly!'))

app.fire()

3. Run

ローカルで開発サーバーを起動し、ブラウザで http://localhost:7676 にアクセスしてください。

sh
npm run start
sh
yarn start
sh
pnpm run start
sh
bun run start

4. デプロイ

To build and deploy your application to your Fastly account, type the following command. The first time you deploy the application, you will be prompted to create a new service in your account.

If you don't have an account yet, you must create your Fastly account.

sh
npm run deploy
sh
yarn deploy
sh
pnpm run deploy
sh
bun run deploy

Released under the MIT License.