ultimate-express 1.3.19 → 1.4.0

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 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&section=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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-express",
3
- "version": "1.3.19",
3
+ "version": "1.4.0",
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": {
@@ -55,13 +55,17 @@ class Application extends Router {
55
55
  if(typeof settings.threads !== 'number') {
56
56
  settings.threads = cpuCount > 1 ? 1 : 0;
57
57
  }
58
- if(settings.uwsOptions.key_file_name && settings.uwsOptions.cert_file_name) {
58
+ if(settings.http3) {
59
+ if(!settings.uwsOptions.key_file_name || !settings.uwsOptions.cert_file_name) {
60
+ throw new Error('uwsOptions.key_file_name and uwsOptions.cert_file_name are required for HTTP/3');
61
+ }
62
+ this.uwsApp = uWS.H3App(settings.uwsOptions);
63
+ } else if(settings.uwsOptions.key_file_name && settings.uwsOptions.cert_file_name) {
59
64
  this.uwsApp = uWS.SSLApp(settings.uwsOptions);
60
- this.ssl = true;
61
65
  } else {
62
66
  this.uwsApp = uWS.App(settings.uwsOptions);
63
- this.ssl = false;
64
67
  }
68
+ this.ssl = settings.uwsOptions.key_file_name && settings.uwsOptions.cert_file_name;
65
69
  this.cache = new NullObject();
66
70
  this.engines = {};
67
71
  this.locals = {