@thzero/library_server_fastify 0.15.37 → 0.15.41

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/boot/index.js CHANGED
@@ -9,7 +9,6 @@ import fastifyRoutes from 'fastify-routes';
9
9
  import fastifyStatic from 'fastify-static';
10
10
 
11
11
  import LibraryConstants from '@thzero/library_server/constants';
12
- import LibraryCommonServiceConstants from '@thzero/library_common_service/constants';
13
12
 
14
13
  import injector from '@thzero/library_common/utility/injector';
15
14
 
@@ -33,9 +32,16 @@ class FastifyBootMain extends BootMain {
33
32
 
34
33
  // return server;
35
34
  // };
35
+
36
+ let http2 = this._appConfig.get('http2', false);
37
+ http2 = http2 === 'true' ? true : false;
38
+ this.loggerServiceI.info2(`config.http2.override: ${http2}`);
36
39
 
37
40
  // const fastify = Fastify({ serverFactory, logger: true });
38
- const fastify = Fastify({ logger: true });
41
+ const fastify = Fastify({
42
+ http2: http2,
43
+ logger: true
44
+ });
39
45
  const serverHttp = fastify.server;
40
46
 
41
47
  await fastify.register(fastifyRoutes);
@@ -302,7 +308,11 @@ class FastifyBootMain extends BootMain {
302
308
  usageMetrics: this.usageMetricsServiceI
303
309
  });
304
310
 
305
- return { app: fastify, server: serverHttp, listen: fastify.listen };
311
+ return {
312
+ app: fastify,
313
+ server: serverHttp,
314
+ listen: fastify.listen
315
+ };
306
316
  }
307
317
 
308
318
  _initAuthentication(map) {
@@ -315,8 +325,8 @@ class FastifyBootMain extends BootMain {
315
325
  return map;
316
326
  }
317
327
 
318
- _initAppListen(app, server, port, err) {
319
- app.listen(port, err);
328
+ _initAppListen(app, server, address, port, err) {
329
+ app.listen(port, address, err);
320
330
  }
321
331
 
322
332
  async _initAppPost(app, args) {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@thzero/library_server_fastify",
3
3
  "type": "module",
4
- "version": "0.15.37",
4
+ "version": "0.15.41",
5
5
  "version_major": 0,
6
6
  "version_minor": 15,
7
- "version_patch": 37,
8
- "version_date": "04/24/2022",
7
+ "version_patch": 41,
8
+ "version_date": "05/28/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",
@@ -34,7 +34,7 @@ class AdminBaseRoute extends BaseRoute {
34
34
 
35
35
  _initializeRoutesCreate(router) {
36
36
  const self = this;
37
- router.post(this._join('/'),
37
+ router.post(this._join(''),
38
38
  // authentication(true),
39
39
  // authorization([ `${self._options.role}.create` ]),
40
40
  {
package/routes/home.js CHANGED
@@ -10,9 +10,13 @@ class HomeRoute extends BaseRoute {
10
10
  }
11
11
 
12
12
  _initializeRoutes(router) {
13
+ // eslint-disable-next-linethis._prefix
14
+ router.get(this._join(''), (request, reply) => {
15
+ reply.status(494).send();
16
+ });
13
17
  // eslint-disable-next-linethis._prefix
14
18
  router.get(this._join('/'), (request, reply) => {
15
- reply.status(401).send();
19
+ reply.status(494).send();
16
20
  });
17
21
  }
18
22
 
package/routes/plans.js CHANGED
@@ -1,7 +1,5 @@
1
1
  import LibraryConstants from '@thzero/library_server/constants';
2
2
 
3
- import Utility from '@thzero/library_common/utility';
4
-
5
3
  import BaseRoute from './index';
6
4
 
7
5
  class PlansRoute extends BaseRoute {
@@ -22,7 +20,7 @@ class PlansRoute extends BaseRoute {
22
20
  }
23
21
 
24
22
  _initializeRoutes(router) {
25
- router.get(this._join('/'),
23
+ router.get(this._join(''),
26
24
  // eslint-disable-next-line
27
25
  async (request, reply) => {
28
26
  // const service = this._injector.getService(LibraryConstants.InjectorKeys.SERVICE_PLANS);