GifproGifpro

Blazing Fast! Hono Edge API on Cloudflare Workers

CODE PREVIEW

エディタを読み込み中…
P

Prompt

Build a complete, minimal Hono Edge API example deployed on Cloudflare Workers. Include routes for GET, POST, and JSON responses with error handling.

Honoは軽量で超高速な、エッジ向けWebフレームワークです。この例では、Cloudflare Workers上に3つのエンドポイント(GET /GET /hello/:namePOST /data)を持つミニマルなREST APIをデプロイします。エラーハンドリングと404ハンドラも含まれています。使い方は、npm create cloudflare@latest my-api -- --template hono でプロジェクトを作成し、生成された src/index.ts を上記のコードに置き換えて npm run deploy するだけ。瞬時にグローバルなエッジネットワーク上でAPIが稼働します。

Prompt Overview

Hono is a lightweight, ultrafast web framework designed for the edge. In this example, we deploy a minimal REST API on Cloudflare Workers with three endpoints: GET /, GET /hello/:name, and POST /data. The code includes error handling and a 404 handler. To use, simply run npm create cloudflare@latest my-api -- --template hono and replace the generated src/index.ts with the code above. Then npm run deploy. Your API will be live globally on Cloudflare's edge network in seconds.

Was this prompt helpful?

Comments

Comments appear after moderation

この記事が役に立ったら投げ銭で応援

Apple Pay / Google Pay / カード (Visa/Mastercard/JCB/Amex) / Link / Alipay / WeChat Pay 対応 · Stripeで安全に決済

開発者が選ぶ最強ツール集

運営者が毎日使っているツール・ガジェット 6選

見る
Homeヘルプ