Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit dbcb47d

Browse files
Rolando Santamaria MasoRolando Santamaria Maso
authored andcommitted
adding undici demo
1 parent f90f26d commit dbcb47d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ This flag could controls the settings of the undici client, like so:
6767
}
6868
...
6969
```
70+
> See undici demo at: `demos/gateway-undici.js`
7071
7172
#### cacheURLs
7273
The number of parsed URLs that will be cached. Default: 100.

demos/gateway-undici.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict'
2+
3+
const { proxy } = require('../index')({
4+
base: 'http://127.0.0.1:3000',
5+
undici: {
6+
connections: 100,
7+
pipelining: 10
8+
}
9+
})
10+
11+
const service = require('restana')()
12+
service.all('/service/*', (req, res) => proxy(req, res, req.url, {
13+
rewriteRequestHeaders (req, headers) {
14+
delete headers.connection
15+
16+
return headers
17+
}
18+
}))
19+
20+
service.start(8080)

0 commit comments

Comments
 (0)