@grandlinex/kernel 0.25.2 → 0.25.3

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.
@@ -1,4 +1,6 @@
1
+ /// <reference types="node" />
1
2
  import express from 'express';
3
+ import http from 'http';
2
4
  import { CorePresenter, IDataBase } from '@grandlinex/core';
3
5
  import { IBaseCache, IBaseClient, IBaseKernelModule, IBasePresenter, IKernel } from '../lib';
4
6
  export default abstract class BaseEndpoint<K extends IKernel = IKernel, T extends IDataBase<any, any> | null = any, P extends IBaseClient | null = any, C extends IBaseCache | null = any, E extends IBasePresenter | null = any> extends CorePresenter<express.Express, K, T, P, C, E> implements IBasePresenter {
@@ -9,4 +11,5 @@ export default abstract class BaseEndpoint<K extends IKernel = IKernel, T extend
9
11
  start(): Promise<boolean>;
10
12
  stop(): Promise<boolean>;
11
13
  getApp(): express.Express;
14
+ getServer(): http.Server;
12
15
  }
@@ -19,6 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  var express_1 = __importDefault(require("express"));
22
+ var http_1 = __importDefault(require("http"));
22
23
  var body_parser_1 = require("body-parser");
23
24
  var core_1 = require("@grandlinex/core");
24
25
  var BaseEndpoint = /** @class */ (function (_super) {
@@ -28,13 +29,13 @@ var BaseEndpoint = /** @class */ (function (_super) {
28
29
  _this.port = port;
29
30
  _this.appServer = (0, express_1.default)();
30
31
  _this.appServer.use((0, body_parser_1.json)());
31
- _this.httpServer = null;
32
+ _this.httpServer = http_1.default.createServer(_this.appServer);
32
33
  return _this;
33
34
  }
34
35
  BaseEndpoint.prototype.start = function () {
35
36
  var _this = this;
36
37
  return new Promise(function (resolve) {
37
- _this.httpServer = _this.appServer
38
+ _this.httpServer
38
39
  .listen(_this.port, function () {
39
40
  _this.debug("Endpoint listen on ".concat(_this.port));
40
41
  resolve(true);
@@ -56,6 +57,9 @@ var BaseEndpoint = /** @class */ (function (_super) {
56
57
  BaseEndpoint.prototype.getApp = function () {
57
58
  return this.appServer;
58
59
  };
60
+ BaseEndpoint.prototype.getServer = function () {
61
+ return this.httpServer;
62
+ };
59
63
  return BaseEndpoint;
60
64
  }(core_1.CorePresenter));
61
65
  exports.default = BaseEndpoint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grandlinex/kernel",
3
- "version": "0.25.2",
3
+ "version": "0.25.3",
4
4
  "description": "GrandLineX is an out-of-the-box server framework on top of ExpressJs.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",