nodejs / nodejs/node

Add http.serve() API based on Fetch (Request -> Response)

Open
#63,096 8 comments 38 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request http
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing Node's existing http.createServer API and the discussion in issue #42529. The proposed work is to define and add http.serve(handler) using Request and Response while keeping createServer available. Done means the API shape and behavior are agreed, implemented, and covered for synchronous and asynchronous handlers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.