You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+79-39Lines changed: 79 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,18 @@
1
1
# 0http
2
2
Cero friction HTTP framework:
3
3
- Tweaked Node.js Server for high throughput.
4
-
- The request router you like.
5
-
6
-
> If no router is provided, it uses the `find-my-way` router as default implementation.
4
+
- Use the request router you like.
7
5
8
6
## Usage
9
7
```js
10
8
constcero=require('0http')
11
9
const { router, server } =cero()
12
10
13
-
router.on('GET', '/hello', (req, res) => {
11
+
router.get('/hello', (req, res) => {
14
12
res.end('Hello World!')
15
13
})
16
14
17
-
router.on('POST', '/do', (req, res) => {
15
+
router.post('/do', (req, res) => {
18
16
// ...
19
17
res.statusCode=201
20
18
res.end()
@@ -30,41 +28,49 @@ server.listen(3000)
30
28
```js
31
29
router.lookup= (req, res) // -> should trigger router search and handlers execution
32
30
```
33
-
### find-my-way router
34
-
> https://github.com/delvedor/find-my-way
35
-
36
-
This is the default router in `0http` if no router is provided via configuration. Internally uses a [Radix Tree](https://en.wikipedia.org/wiki/Radix_tree)
37
-
router that will bring better performance over iterative regular expressions matching.
38
31
39
-
### 0http - sequential
40
-
This a `0http` extended implementation of the [trouter](https://www.npmjs.com/package/trouter) router. Includes support for middlewares and shortcuts for routes registration.
41
-
As this is an iterative regular expression matching router, it tends to be slower than `find-my-way` when the number of registered routes increases. However, tiny micro-services should not see major performance degradation.
32
+
### 0http - sequential (default router)
33
+
This a `0http` extended implementation of the [trouter](https://www.npmjs.com/package/trouter) router. Includes support for middlewares, nested routers and shortcuts for routes registration.
34
+
As this is an iterative regular expression matching router, it tends to be slower than `find-my-way` when the number of registered routes increases; to mitigate this issue, we use
35
+
an internal LRU cache to store the matching results of the previous requests, resulting on a super-fast matching process.
0 commit comments