Add http.serve() API based on Fetch (Request -> Response)
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
What is the problem this feature will solve?
Node provides fetch, Request/Response, and Web Streams, but no high level server API using this model.
Other runtimes such as Deno and Bun expose a serve API based on the Fetch contract. In Node, similar patterns are commonly implemented in userland (e.g., frameworks like Hono), which indicates demand for this abstraction.
This was discussed in #42529 and received support, however that issue is focused on request.toWeb(), so opening a separate issue focused on this API.
What is the feature you are proposing to solve the problem?
Add a high-level http.serve(handler) API.
An example shape could be:
http.serve((req) => new Response("ok"))
handler: (Request) => Response | Promise<Response>
This would coexist with the existing http.createServer, and be a high level alternative using WHATWG APIs instead.
What alternatives have you considered?
- Continue using
http.createServerdirectly. - Implement this in userland, or use existing 3rd party solutions.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、Node の既存の http.createServer API と issue #42529 の議論を確認します。提案されている作業は、Request と Response を使用して http.serve(handler) を定義・追加し、createServer を引き続き利用可能にすることです。完了条件は、API の形状と動作について合意され、実装され、同期および非同期のハンドラーについてカバーされていることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, nodejs
- 領域
- backend-api-design
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100