Blazing Fast! Hono Edge API on Cloudflare Workers
CODE PREVIEW
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/:name、POST /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