ultimate-express 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/package.json +2 -1
- package/src/response.js +4 -3
package/README.md
CHANGED
|
@@ -23,15 +23,15 @@ Similar projects based on uWebSockets:
|
|
|
23
23
|
|
|
24
24
|
Tested using [wrk](https://github.com/wg/wrk) (`-d 60 -t 1 -c 200`). Etag was disabled in both Express and µExpress. Tested on Ubuntu 22.04, Node.js 20.17.0, AMD Ryzen 5 3600, 64GB RAM.
|
|
25
25
|
|
|
26
|
-
| Test
|
|
27
|
-
|
|
|
28
|
-
| routing/simple-routes
|
|
29
|
-
| routing/lot-of-routes
|
|
30
|
-
| routing/some-middlewares
|
|
31
|
-
| routers/nested-routers
|
|
32
|
-
| middlewares/express-static
|
|
33
|
-
| engines/ejs
|
|
34
|
-
| middlewares/body-urlencoded
|
|
26
|
+
| Test | Express req/sec | µExpress req/sec | Express throughput | µExpress throughput | µExpress speedup |
|
|
27
|
+
| --------------------------------------------- | --------------- | ---------------- | ------------------ | ------------------- | ---------------- |
|
|
28
|
+
| routing/simple-routes (/) | 10.90k | 70.10k | 2.04 MB/sec | 11.57 MB/sec | **6.43X** |
|
|
29
|
+
| routing/lot-of-routes (/999) | 4.66k | 51.58k | 0.85 MB/sec | 8.07 MB/sec | **11.07X** |
|
|
30
|
+
| routing/some-middlewares (/90) | 10.18k | 66.97k | 1.81 MB/sec | 10.42 MB/sec | **6.58X** |
|
|
31
|
+
| routers/nested-routers (/abccc/nested/ddd) | 10.25k | 50.98k | 1.83 MB/sec | 7.98 MB/sec | **4.97X** |
|
|
32
|
+
| middlewares/express-static (/static/index.js) | 7.52k | 31.08k | 6.92 MB/sec | 26.48 MB/sec | **4.13X** |
|
|
33
|
+
| engines/ejs (/test) | 5.92k | 14.43k | 2.40 MB/sec | 5.53 MB/sec | **2.44X** |
|
|
34
|
+
| middlewares/body-urlencoded (/abc) | 7.90k | 29.90k | 1.64 MB/sec | 5.36 MB/sec | **3.78X** |
|
|
35
35
|
|
|
36
36
|
Also tested on a real-world application with templates, static files and dynamic pages with data from database ([nekoweb.org](https://nekoweb.org)), and showed about 1.5-4X speedup in requests per second.
|
|
37
37
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ultimate-express",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "The Ultimate Express. Fastest http server with full Express compatibility, based on uWebSockets.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"body-parser": "^1.20.3",
|
|
40
40
|
"cookie": "^0.6.0",
|
|
41
41
|
"cookie-signature": "^1.2.1",
|
|
42
|
+
"encodeurl": "^2.0.0",
|
|
42
43
|
"etag": "^1.8.1",
|
|
43
44
|
"fresh": "^0.5.2",
|
|
44
45
|
"mime-types": "^2.1.35",
|
package/src/response.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const cookie = require("cookie");
|
|
2
2
|
const mime = require("mime-types");
|
|
3
3
|
const vary = require("vary");
|
|
4
|
+
const encodeUrl = require("encodeurl");
|
|
4
5
|
const {
|
|
5
6
|
normalizeType, stringify, deprecated, UP_PATH_REGEXP, decode,
|
|
6
7
|
containsDotFile, isPreconditionFailure, isRangeFresh, parseHttpDate
|
|
@@ -185,7 +186,7 @@ module.exports = class Response extends Writable {
|
|
|
185
186
|
body = '';
|
|
186
187
|
} else if(typeof body === 'object') {
|
|
187
188
|
if(!(body instanceof ArrayBuffer)) {
|
|
188
|
-
|
|
189
|
+
return this.json(body);
|
|
189
190
|
}
|
|
190
191
|
} else if(typeof body === 'number') {
|
|
191
192
|
if(arguments[1]) {
|
|
@@ -421,7 +422,7 @@ module.exports = class Response extends Writable {
|
|
|
421
422
|
if(!name) {
|
|
422
423
|
name = Path.basename(path);
|
|
423
424
|
}
|
|
424
|
-
if(!opts.root) {
|
|
425
|
+
if(!opts.root && !isAbsolute(path)) {
|
|
425
426
|
opts.root = process.cwd();
|
|
426
427
|
}
|
|
427
428
|
|
|
@@ -596,7 +597,7 @@ module.exports = class Response extends Writable {
|
|
|
596
597
|
if(!path) path = this.req.get('Referer');
|
|
597
598
|
if(!path) path = '/';
|
|
598
599
|
}
|
|
599
|
-
return this.set('Location',
|
|
600
|
+
return this.set('Location', encodeUrl(path));
|
|
600
601
|
}
|
|
601
602
|
redirect(status, url) {
|
|
602
603
|
if(typeof status !== 'number' && !url) {
|