ultimate-express 1.3.19 → 1.4.1
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 +18 -0
- package/package.json +1 -1
- package/src/application.js +9 -3
- package/src/types.d.ts +2 -0
package/README.md
CHANGED
|
@@ -53,6 +53,10 @@ For full table with other runtimes, check [here](https://github.com/dimdenGD/bun
|
|
|
53
53
|
| koa | 24,045.08 | 28,202.12 | 24,590.84 | 19,342.28 |
|
|
54
54
|
| express | 10,411.313 | 11,245.57 | 10,598.74 | 9,389.63 |
|
|
55
55
|
|
|
56
|
+
Other benchmarks:
|
|
57
|
+
- [TechEmpower / FrameworkBenchmarks](https://www.techempower.com/benchmarks/#hw=ph&test=composite§ion=data-r23&l=zik0sf-cn3)
|
|
58
|
+
- [the-benchmarker / web-frameworks](https://web-frameworks-benchmark.netlify.app/result?l=javascript)
|
|
59
|
+
|
|
56
60
|
### Performance on real-world application
|
|
57
61
|
|
|
58
62
|
Also tested on a [real-world application](https://nekoweb.org) with templates, static files and dynamic pages with data from database, and showed 1.5-4X speedup in requests per second depending on the page.
|
|
@@ -122,6 +126,20 @@ Since you don't create http server manually, you can't properly use http.on("upg
|
|
|
122
126
|
- There's a sister library that implements `ws` compatible API: [Ultimate WS](https://github.com/dimdenGD/ultimate-ws). It's same concept as this library, but for WebSockets: fast drop-in replacement for `ws` module with support for Ultimate Express upgrades. There's a guide for how to upgrade http requests in the documentation.
|
|
123
127
|
- You can simply use `app.uwsApp` to access uWebSockets.js `App` instance and call its `ws()` method directly.
|
|
124
128
|
|
|
129
|
+
## HTTP/3
|
|
130
|
+
|
|
131
|
+
HTTP/3 is supported. To use:
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
const app = express({
|
|
135
|
+
http3: true,
|
|
136
|
+
uwsOptions: {
|
|
137
|
+
key_file_name: '/path/to/example.key',
|
|
138
|
+
cert_file_name: '/path/to/example.crt'
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
125
143
|
## Compatibility
|
|
126
144
|
|
|
127
145
|
In general, basically all features and options are supported. Use [Express 4.x documentation](https://expressjs.com/en/4x/api.html) for API reference.
|
package/package.json
CHANGED
package/src/application.js
CHANGED
|
@@ -55,13 +55,19 @@ class Application extends Router {
|
|
|
55
55
|
if(typeof settings.threads !== 'number') {
|
|
56
56
|
settings.threads = cpuCount > 1 ? 1 : 0;
|
|
57
57
|
}
|
|
58
|
-
if(settings.
|
|
58
|
+
if(settings.uwsApp) {
|
|
59
|
+
this.uwsApp = settings.uwsApp;
|
|
60
|
+
} else if(settings.http3) {
|
|
61
|
+
if(!settings.uwsOptions.key_file_name || !settings.uwsOptions.cert_file_name) {
|
|
62
|
+
throw new Error('uwsOptions.key_file_name and uwsOptions.cert_file_name are required for HTTP/3');
|
|
63
|
+
}
|
|
64
|
+
this.uwsApp = uWS.H3App(settings.uwsOptions);
|
|
65
|
+
} else if(settings.uwsOptions.key_file_name && settings.uwsOptions.cert_file_name) {
|
|
59
66
|
this.uwsApp = uWS.SSLApp(settings.uwsOptions);
|
|
60
|
-
this.ssl = true;
|
|
61
67
|
} else {
|
|
62
68
|
this.uwsApp = uWS.App(settings.uwsOptions);
|
|
63
|
-
this.ssl = false;
|
|
64
69
|
}
|
|
70
|
+
this.ssl = settings.uwsOptions.key_file_name && settings.uwsOptions.cert_file_name;
|
|
65
71
|
this.cache = new NullObject();
|
|
66
72
|
this.engines = {};
|
|
67
73
|
this.locals = {
|