Skip to content

Commit

Permalink
docs: update diff explainer
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Oct 15, 2024
1 parent 9598308 commit fbd81af
Show file tree
Hide file tree
Showing 3 changed files with 9,816 additions and 11 deletions.
10 changes: 10 additions & 0 deletions docs/1.guide/0.why.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ There are subtle differences between [Deno][Deno] and [Bun][Bun] too in the way

Main use-case of this library is for tools and frameworks that want to be runtime agnostic. By using srvx as standard server layer, instead of depending on of the individual runtime APIs, we push javascript ecosystem to be more consistent and moving towards web standards!

## How is it different?

You might ask, what is the difference between srvx and other HTTP frameworks like [h3](https://h3.unjs.io/), [Nitro](https://nitro.unjs.io/), and [Express](https://expressjs.com/)?

Srvx provides a simple, low-level, and universal API, very similar to [Deno][Deno] and [Bun][Bun]. It has **no conventions**, utilities, or router, and in most cases, using srvx introduces **zero overhead**.

We plan to adopt srvx as the runtime-agnostic server API across the ecosystem ([h3](https://h3.unjs.io/), [Nitro](https://nitro.unjs.io/), [Listhen](https://listhen.unjs.io/), and more). So if you're using one of these today, you'll soon benefit from srvx without even needing to read this documentation!

The idea of srvx was extracted from the [h3](https://h3.unjs.io/) v2 development branch and opened to a broader ecosystem to encourage the adoption of Web platform standards without enforcing it's own conventions.

[Deno]: https://deno.com/
[Bun]: https://bun.sh/
[Node.js]: https://nodejs.org/
Expand Down
18 changes: 7 additions & 11 deletions docs/1.guide/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ icon: ph:book-open-duotone

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" title="Why srvx"}
::read-more{to="/guide/why"}
Why srvx?
::

::read-more{to="/guide/why#how-is-it-different"}
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.

Expand All @@ -21,16 +27,6 @@ For [Deno](Deno) and [Bun](Bun) srvx unifies interface with zero overhead and fo
[IncomingMessage]: https://nodejs.org/api/http.html#http_class_http_incomingmessage
[ServerResponse]: https://nodejs.org/api/http.html#http_class_http_serverresponse

## How is it different from other http frameworks?

You might ask, what is the difference between srvx and other http frameworks such as [h3](https://h3.unjs.io/), [nitro](https://nitro.unjs.io/) and [express](https://expressjs.com/).

Srvx, adds a simple, low-level and universal API very similar to [Deno][Deno] and [Bun][Bun]. It has **no conventions**, utils or router and in most of the cases using servx has **zero-overhead**.

We plan to adopt srvx as the runtime-agnostic server API across UnJS and beyond ([h3](https://h3.unjs.io/), [nitro](https://nitro.unjs.io/), [listhen](https://listhen.unjs.io/)), so if you are using one of these today, you will soon already leverage srvx without even needing to read this docs!

The idea of srvx had been extracted from [h3](https://h3.unjs.io/) v2 development branch and opened to a wider ecosystem in order to help adoption of Web platform standards without enforcing conventions of our choices.

## Quick start

A server can be started using `serve` function from `srvx` package.
Expand Down
Loading

0 comments on commit fbd81af

Please sign in to comment.