Skip to content

Commit bd581a3

Browse files
authored
Merge pull request #19 from jkyberneees/drop-low-implementation
Drop low implementation
2 parents 74c4814 + fb1f18c commit bd581a3

File tree

6 files changed

+18
-253
lines changed

6 files changed

+18
-253
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
node_js:
3+
- "10"
4+
5+
install: npm install

README.md

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -156,39 +156,6 @@ const { router, server } = cero({
156156
If no server is provided by configuration, the standard Node.js [http.Server](https://nodejs.org/api/http.html#http_class_http_server) implementation is used.
157157
Because this server offers the best balance between Node.js ecosystem compatibility and performance, we highly recommend it for most use cases.
158158

159-
### Low Server
160-
`low` is a tiny Node.js friendly wrapper around the great [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js) HTTP server. I/O throughput is
161-
maximized at the cost of API compatibility.
162-
> As far as for Node.js, `uWebSockets.js` brings the best I/O performance in terms of HTTP support.
163-
164-
#### Install dependencies
165-
```
166-
npm i uNetworking/uWebSockets.js#v15.11.0
167-
```
168-
#### Example usage
169-
```js
170-
const low = require('0http/lib/server/low')
171-
const cero = require('0http')
172-
173-
const { router, server } = cero({
174-
server: low()
175-
})
176-
177-
router.get('/hi', (req, res) => {
178-
res.end('Hello World!')
179-
})
180-
181-
server.listen(3000, (socket) => {
182-
if (socket) {
183-
console.log('HTTP server ready!')
184-
}
185-
})
186-
187-
188-
// ...
189-
server.close()
190-
```
191-
192159
## Benchmarks (30/12/2019)
193160
**Node version**: v12.14.0
194161
**Laptop**: MacBook Pro 2019, 2,4 GHz Intel Core i9, 32 GB 2400 MHz DDR4
@@ -199,10 +166,6 @@ wrk -t8 -c40 -d5s http://127.0.0.1:3000/hi
199166
```
200167

201168
### 1 route registered
202-
- **0http (find-my-way + low)**
203-
`Requests/sec: 135436.99`
204-
- 0http (sequential + low)
205-
`Requests/sec: 134281.32`
206169
- 0http (sequential)
207170
`Requests/sec: 88438.69`
208171
- 0http (find-my-way)
@@ -226,4 +189,8 @@ You can support the maintenance of this project:
226189
- XRP Crypto Coin: `rarQgNuiqF9gFLLwd5fdku4jYa9EXpiyCp`
227190
- TRON Crypto Coin: `TJ5Bbf9v4kpptnRsePXYDvnYcYrS5Tyxus`
228191
- BITCOIN Crypto Coin: `bc1qcrr58venyh54ztvkqym39p9rhnxg4308t0802f`
229-
- Ethereum Crypto Coin: `0xD73c8E63a83eBD8Df3fB3d0090f1fe7a1eEB980B`
192+
- Ethereum Crypto Coin: `0xD73c8E63a83eBD8Df3fB3d0090f1fe7a1eEB980B`
193+
194+
## Breaking Changes:
195+
### 3.x
196+
- Low HTTP server implementation was moved to: https://github.com/jkyberneees/low-http-server

lib/server/low.js

Lines changed: 0 additions & 193 deletions
This file was deleted.

lib/utils/string.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@
3030
"devDependencies": {
3131
"chai": "^4.2.0",
3232
"find-my-way": "^3.0.1",
33-
"mocha": "^7.2.0",
33+
"mocha": "^8.1.3",
3434
"nyc": "^15.1.0",
35-
"standard": "^14.3.4",
3635
"supertest": "^4.0.2",
37-
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v17.5.0"
36+
"body-parser": "^1.19.0"
3837
},
3938
"files": [
4039
"LICENSE",
@@ -43,7 +42,7 @@
4342
"lib/"
4443
],
4544
"dependencies": {
46-
"lru-cache": "^5.1.1",
45+
"lru-cache": "^6.0.0",
4746
"trouter": "^3.1.0"
4847
}
4948
}

tests/smoke.test.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ const expect = require('chai').expect
33
const request = require('supertest')
44
const path = require('path')
55
const { createReadStream } = require('fs')
6+
const bodyParser = require('body-parser')
67

78
describe('0http Web Framework - Smoke', () => {
89
const baseUrl = 'http://localhost:' + process.env.PORT
910

1011
const { router, server } = require('../index')({
11-
server: require('../lib/server/low')(),
1212
router: require('../lib/router/sequential')()
1313
})
1414

1515
it('should successfully register service routes', (done) => {
16+
router.use(bodyParser.json())
1617
router.use((req, res, next) => next())
1718
router.use('/', (req, res, next) => next())
1819

@@ -32,7 +33,7 @@ describe('0http Web Framework - Smoke', () => {
3233
})
3334

3435
router.post('/echo', (req, res) => {
35-
res.end(req.body)
36+
res.end(JSON.stringify(req.body))
3637
})
3738

3839
router.get('/qs', (req, res) => {
@@ -84,10 +85,8 @@ describe('0http Web Framework - Smoke', () => {
8485
res.end(`${req.stepUrl} - ${req.url}`)
8586
})
8687

87-
server.start(~~process.env.PORT, serverSocket => {
88-
if (serverSocket) {
89-
done()
90-
}
88+
server.listen(~~process.env.PORT, () => {
89+
done()
9190
})
9291
})
9392

0 commit comments

Comments
 (0)