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.createServer directly.
- Implement this in userland, or use existing 3rd party solutions.
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
serveAPI 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:
This would coexist with the existing
http.createServer, and be a high level alternative using WHATWG APIs instead.What alternatives have you considered?
http.createServerdirectly.