Skip to content

Commit

Permalink
doc: fix links (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb authored Dec 4, 2024
1 parent 5bc0dce commit f41076b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
22 changes: 11 additions & 11 deletions docs/1.guide/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ icon: ph:book-open-duotone

# Getting started

srvx provides a unified standard API to create HTTP servers based on the standard web platform primitives ([fetch][fetch], [Request][Request] and [Response][Response]) and works seamlessly with [Deno](Deno), [Bun](Bun) and [Node.js](Node.js).
srvx provides a unified standard API to create HTTP servers based on the standard web platform primitives ([fetch][fetch], [Request][Request] and [Response][Response]) and works seamlessly with [Deno][Deno], [Bun][Bun] and [Node.js][Node.js].

::read-more{to="/guide/why"}
Why srvx?
Expand All @@ -14,19 +14,10 @@ Why srvx?
How srvx is different from express, h3, nitro, ...
::

For [Deno](Deno) and [Bun](Bun) srvx unifies interface with zero overhead and for [Node.js][Node.js], creates a lightweight compatibility layer to wrap [node:IncomingMessage](IncomingMessage) as a standard [Request](Request) object and convert final state of [node:ServerResponse](ServerResponse) to a standard [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) object.
For [Deno][Deno] and [Bun][Bun] srvx unifies interface with zero overhead and for [Node.js][Node.js], creates a lightweight compatibility layer to wrap [node:IncomingMessage][IncomingMessage] as a standard [Request][Request] object and convert final state of [node:ServerResponse][ServerResponse] to a standard [Response][Response] object.

:read-more{to="/guide/node" title="Node.js support"}

[Deno]: https://deno.com/
[Bun]: https://bun.sh/
[Node.js]: https://nodejs.org/
[fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
[Request]: https://developer.mozilla.org/en-US/docs/Web/API/Request
[Response]: https://developer.mozilla.org/en-US/docs/Web/API/Response
[IncomingMessage]: https://nodejs.org/api/http.html#http_class_http_incomingmessage
[ServerResponse]: https://nodejs.org/api/http.html#http_class_http_serverresponse

## Quick start

A server can be started using `serve` function from `srvx` package.
Expand All @@ -44,3 +35,12 @@ await server.ready();

console.log(`🚀 Server ready at ${server.url}`);
```

[Deno]: https://deno.com/
[Bun]: https://bun.sh/
[Node.js]: https://nodejs.org/
[fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
[Request]: https://developer.mozilla.org/en-US/docs/Web/API/Request
[Response]: https://developer.mozilla.org/en-US/docs/Web/API/Response
[IncomingMessage]: https://nodejs.org/api/http.html#http_class_http_incomingmessage
[ServerResponse]: https://nodejs.org/api/http.html#http_class_http_serverresponse
4 changes: 1 addition & 3 deletions docs/1.guide/7.node.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ You can locally run benchmarks by cloning [srvx repository](https://github.com/u

## Reverse compatibility

srvx converts a [fetch][fetch]-like [Request][Request] => [Response][Response] handler to [node:IncomingMessage](IncomingMessage) => [node:ServerResponse](ServerResponse) handler that is compatible **with** Node.js runtime.
srvx converts a [fetch][fetch]-like [Request][Request] => [Response][Response] handler to [node:IncomingMessage][IncomingMessage] => [node:ServerResponse][ServerResponse] handler that is compatible **with** Node.js runtime.

If you want to instead convert a Node.js server handler (like [Express][Express]) with `(req, IncomingMessage, res: ServerResponse)` signature to [fetch][fetch]-like handler ([Request][Request] => [Response][Response]) that can work **without** Node.js runtime you can instead use [unjs/unenv](https://unenv.unjs.io) Node.js compatibility layer to emulate Node.js API.

Expand All @@ -86,8 +86,6 @@ const res = await serverFetch("/test", { headers: { foo: "bar" } });
console.log(res);
```

[Deno]: https://deno.com/
[Bun]: https://bun.sh/
[Node.js]: https://nodejs.org/
[fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
[Request]: https://developer.mozilla.org/en-US/docs/Web/API/Request
Expand Down

0 comments on commit f41076b

Please sign in to comment.