Skip to content

Commit 2198542

Browse files
committed
Use DeclarativeResponse in Benchmarker
1 parent e30b950 commit 2198542

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
/* Non-SSL is simply App() */
2-
require('uWebSockets.js')
3-
.App()
4-
.get('/', (res, req) => {
5-
res.writeHeader('content-type', 'text/plain').end('Hi')
6-
})
7-
.get('/id/:id', (res, req) => {
8-
res.writeHeader('content-type', 'text/plain')
9-
.writeHeader('x-powered-by', 'benchmark')
10-
.end(`${req.getParameter('id')} ${req.getQuery('name')}`)
11-
})
2+
const uWS = require('uWebSockets.js');
3+
uWS.App()
4+
.get('/', new uWS.DeclarativeResponse().writeHeader('content-type', 'text/plain').end('Hi'))
5+
.get('/id/:id', new uWS.DeclarativeResponse().writeHeader('content-type', 'text/plain')
6+
.writeHeader('x-powered-by', 'benchmark')
7+
.writeParameterValue("id")
8+
.write(" ")
9+
.writeQueryValue("name")
10+
.end())
1211
.post('/json', (res, req) => {
1312
readJson(
1413
res,

0 commit comments

Comments
 (0)