Skip to content

Commit

Permalink
Fix example in README
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Dec 4, 2024
1 parent daa402c commit 7500c3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/node-fetch-server/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

This is the changelog for [`node-fetch-server`](https://github.com/mjackson/remix-the-web/tree/main/packages/node-fetch-server). It follows [semantic versioning](https://semver.org/).

## HEAD

- Fix low-level API example in the README

## v0.4.0 (2024-11-26)

- BREAKING: Change new low-level API `createRequest(req, options)` to `createRequest(req, res, options)` so the abort signal fires on the `res`'s "end" event instead of `req`
- BREAKING: Change `createRequest` signature to `createRequest(req, res, options)` so the abort signal fires on the `res`'s "end" event instead of `req`

## v0.3.0 (2024-11-20)

Expand Down
2 changes: 1 addition & 1 deletion packages/node-fetch-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ let handler: FetchHandler = (request, client) => {

In addition to the high-level `createRequestListener()` API, this package also provides 2 low-level APIs that are useful when building custom `fetch`-based servers in Node.js:

- `createRequest(req: http.IncomingMessage, options: RequestOptions): Request`
- `createRequest(req: http.IncomingMessage, res: http.ServerResponse, options: RequestOptions): Request`
- `sendResponse(res: http.ServerResponse, response: Response): Promise<void>`

These two functions serve as an efficient, minimal translation layer between Node.js `req`/`res` objects and fetch `Request`/`Response` objects. You could build your own custom server like this:
Expand Down

0 comments on commit 7500c3d

Please sign in to comment.