@reldens/server-utils 0.34.0 → 0.36.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 +1 -8
- package/lib/app-server-factory.js +0 -14
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -9,7 +9,6 @@ A Node.js server toolkit providing secure application server creation, file hand
|
|
|
9
9
|
### AppServerFactory
|
|
10
10
|
- Complete Express.js server configuration with modular security
|
|
11
11
|
- HTTPS/HTTP server creation with SSL certificate management
|
|
12
|
-
- HTTP/2 support via spdy with automatic HTTP/1.1 fallback
|
|
13
12
|
- Optimized static asset caching for CSS, JS, fonts, and images
|
|
14
13
|
- SNI (Server Name Indication) support for multi-domain hosting
|
|
15
14
|
- Virtual host management with domain mapping
|
|
@@ -101,14 +100,13 @@ if(serverResult){
|
|
|
101
100
|
}
|
|
102
101
|
```
|
|
103
102
|
|
|
104
|
-
###
|
|
103
|
+
### HTTPS Server with Optimized Caching
|
|
105
104
|
|
|
106
105
|
```javascript
|
|
107
106
|
let appServerFactory = new AppServerFactory();
|
|
108
107
|
let serverResult = appServerFactory.createAppServer({
|
|
109
108
|
port: 443,
|
|
110
109
|
useHttps: true,
|
|
111
|
-
useHttp2: true,
|
|
112
110
|
keyPath: '/ssl/server.key',
|
|
113
111
|
certPath: '/ssl/server.crt',
|
|
114
112
|
autoListen: true
|
|
@@ -131,7 +129,6 @@ appServerFactory.cacheConfig = {
|
|
|
131
129
|
};
|
|
132
130
|
let serverResult = appServerFactory.createAppServer({
|
|
133
131
|
useHttps: true,
|
|
134
|
-
useHttp2: true
|
|
135
132
|
});
|
|
136
133
|
```
|
|
137
134
|
|
|
@@ -229,7 +226,6 @@ appServerFactory.addDomain({
|
|
|
229
226
|
|
|
230
227
|
let serverResult = appServerFactory.createAppServer({
|
|
231
228
|
useHttps: true,
|
|
232
|
-
useHttp2: true,
|
|
233
229
|
useVirtualHosts: true,
|
|
234
230
|
keyPath: '/ssl/default.key',
|
|
235
231
|
certPath: '/ssl/default.crt',
|
|
@@ -365,9 +361,6 @@ Configurable rate limiting with development mode detection for appropriate thres
|
|
|
365
361
|
### HTTPS Support
|
|
366
362
|
Full SSL/TLS support with SNI for multi-domain hosting and automatic certificate management.
|
|
367
363
|
|
|
368
|
-
### HTTP/2 Support
|
|
369
|
-
HTTP/2 support via spdy with multiplexing for improved performance and automatic HTTP/1.1 fallback for older clients.
|
|
370
|
-
|
|
371
364
|
### Input Validation
|
|
372
365
|
Built-in validators for common input types including email, username, strong passwords, alphanumeric strings, and IP addresses.
|
|
373
366
|
|
|
@@ -12,7 +12,6 @@ const { CorsConfigurer } = require('./app-server-factory/cors-configurer');
|
|
|
12
12
|
const { RateLimitConfigurer } = require('./app-server-factory/rate-limit-configurer');
|
|
13
13
|
const http = require('http');
|
|
14
14
|
const https = require('https');
|
|
15
|
-
const spdy = require('spdy');
|
|
16
15
|
const express = require('express');
|
|
17
16
|
const bodyParser = require('body-parser');
|
|
18
17
|
const session = require('express-session');
|
|
@@ -35,7 +34,6 @@ class AppServerFactory
|
|
|
35
34
|
this.useUrlencoded = true;
|
|
36
35
|
this.encoding = 'utf-8';
|
|
37
36
|
this.useHttps = false;
|
|
38
|
-
this.useHttp2 = false;
|
|
39
37
|
this.passphrase = '';
|
|
40
38
|
this.httpsChain = '';
|
|
41
39
|
this.keyPath = '';
|
|
@@ -382,10 +380,6 @@ class AppServerFactory
|
|
|
382
380
|
createServer()
|
|
383
381
|
{
|
|
384
382
|
if(!this.useHttps){
|
|
385
|
-
if(this.useHttp2){
|
|
386
|
-
this.error = {message: 'HTTP/2 requires HTTPS to be enabled'};
|
|
387
|
-
return false;
|
|
388
|
-
}
|
|
389
383
|
return http.createServer(this.app);
|
|
390
384
|
}
|
|
391
385
|
if(this.useVirtualHosts && 0 < this.domains.length){
|
|
@@ -413,10 +407,6 @@ class AppServerFactory
|
|
|
413
407
|
credentials.ca = ca;
|
|
414
408
|
}
|
|
415
409
|
}
|
|
416
|
-
if(this.useHttp2){
|
|
417
|
-
credentials.spdy = {protocols: ['h2', 'http/1.1']};
|
|
418
|
-
return spdy.createServer(credentials, this.app);
|
|
419
|
-
}
|
|
420
410
|
return https.createServer(credentials, this.app);
|
|
421
411
|
}
|
|
422
412
|
|
|
@@ -445,10 +435,6 @@ class AppServerFactory
|
|
|
445
435
|
let ctx = tls.createSecureContext({key, cert});
|
|
446
436
|
callback(null, ctx);
|
|
447
437
|
};
|
|
448
|
-
if(this.useHttp2){
|
|
449
|
-
httpsOptions.spdy = {protocols: ['h2', 'http/1.1']};
|
|
450
|
-
return spdy.createServer(httpsOptions, this.app);
|
|
451
|
-
}
|
|
452
438
|
return https.createServer(httpsOptions, this.app);
|
|
453
439
|
}
|
|
454
440
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reldens/server-utils",
|
|
3
3
|
"scope": "@reldens",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.36.0",
|
|
5
5
|
"description": "Reldens - Server Utils",
|
|
6
6
|
"author": "Damian A. Pastorini",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"express-session": "1.18.2",
|
|
45
45
|
"helmet": "8.1.0",
|
|
46
46
|
"multer": "2.0.2",
|
|
47
|
-
"sanitize-html": "2.17.0"
|
|
48
|
-
"spdy": "^4.0.2"
|
|
47
|
+
"sanitize-html": "2.17.0"
|
|
49
48
|
}
|
|
50
49
|
}
|