@thzero/library_server_fastify 0.16.8 → 0.16.10

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.
Files changed (2) hide show
  1. package/boot/index.js +14 -0
  2. package/package.json +7 -6
package/boot/index.js CHANGED
@@ -3,6 +3,7 @@ import path from 'path';
3
3
  import Fastify from 'fastify';
4
4
  // import fastifyAuth from '@fastify/auth';
5
5
  import fastifyAuth from '../plugins/auth.js';
6
+ import faastifyCompression from '@fastify/compress';
6
7
  import fastifyCors from '@fastify/cors';
7
8
  import fastifyHelmet from '@fastify/helmet';
8
9
  import fastifyRoutes from '@fastify/routes';
@@ -88,6 +89,15 @@ class FastifyBootMain extends BootMain {
88
89
  helmetOptions
89
90
  );
90
91
 
92
+ const compressionOptions = this._initCompression({
93
+ global: true,
94
+ requestEncodings: [ 'br', 'gzip' ]
95
+ });
96
+ await fastify.register(
97
+ faastifyCompression,
98
+ compressionOptions
99
+ );
100
+
91
101
  // // error
92
102
  // app.use(async (ctx, next) => {
93
103
  // try {
@@ -336,6 +346,10 @@ class FastifyBootMain extends BootMain {
336
346
  this._initPostRoutes(app);
337
347
  }
338
348
 
349
+ _initCompression(options) {
350
+ return options;
351
+ }
352
+
339
353
  _initCors(options) {
340
354
  // https://github.com/fastify/fastify-cors
341
355
  return options;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@thzero/library_server_fastify",
3
3
  "type": "module",
4
- "version": "0.16.8",
4
+ "version": "0.16.10",
5
5
  "version_major": 0,
6
6
  "version_minor": 16,
7
- "version_patch": 8,
8
- "version_date": "11/25/2022",
7
+ "version_patch": 10,
8
+ "version_date": "12/11/2022",
9
9
  "description": "An opinionated library of common functionality to bootstrap a Fastify based API application.",
10
10
  "author": "thZero",
11
11
  "license": "MIT",
@@ -25,11 +25,12 @@
25
25
  "test": "echo \"Error: no test specified\" && exit 1"
26
26
  },
27
27
  "dependencies": {
28
- "@fastify/auth": "^4.1.0",
28
+ "@fastify/auth": "^4.2.0",
29
+ "@fastify/compress": "^6.2.0",
29
30
  "@fastify/cors": "^8.2.0",
30
31
  "@fastify/helmet": "^10.1.0",
31
- "@fastify/routes": "^5.0.0",
32
- "@fastify/static": "^6.5.1",
32
+ "@fastify/routes": "^5.1.0",
33
+ "@fastify/static": "^6.6.0",
33
34
  "async-mutex": "^0.4.0",
34
35
  "fastify": "^4.10.2"
35
36
  },