Bun HTTP Server: Zero Config, 10x Faster
CODE PREVIEW
Prompt
Build an ultra-fast HTTP server using Bun runtime. Show a complete example with routing, JSON response, and file serving. Use no frameworks, just Bun's built-in APIs.
Bun は高速なオールインワンJavaScriptランタイムです。BunでHTTPサーバーを構築するのは信じられないほど簡単で、フレームワークも設定も不要です。組み込みの serve 関数を使うだけ。
以下はルーティング、JSON API、HTMLファイル配信を含む完全な例です。bun run server.js で実行できます。
/ルートは動的なHTMLページを配信/api/helloはタイムスタンプ付きのJSONを返す/api/dataはサンプルデータを返す/public/は静的ファイルを配信
BunのHTTPサーバーは最小限のメモリで毎秒数千リクエストを処理します。マイクロサービス、API、プロトタイピングに最適です。
Prompt Overview
Bun is a fast all-in-one JavaScript runtime. Building an HTTP server with Bun is incredibly simple — no frameworks, no configuration. Just use the built-in serve function.
Here's a complete example with routing, JSON API, and HTML file serving. Run it with bun run server.js.
- Route
/serves a dynamic HTML page /api/helloreturns JSON with a timestamp/api/datareturns sample data/public/serves static files
Bun's HTTP server handles thousands of requests per second with minimal memory. Perfect for microservices, APIs, and prototyping.
Was this prompt helpful?
Comments
Comments appear after moderation
この記事が役に立ったら投げ銭で応援
Apple Pay / Google Pay / カード (Visa/Mastercard/JCB/Amex) / Link / Alipay / WeChat Pay 対応 · Stripeで安全に決済
開発者が選ぶ最強ツール集
運営者が毎日使っているツール・ガジェット 6選