alado 1.2.4 → 1.2.5

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,3 +1,5 @@
1
+ /// <reference types="node" />
2
+ import { Server } from 'http';
1
3
  import { AladoServerOptions } from '../options';
2
4
  import { Context, Response } from '../dto';
3
5
  export declare class AladoServer {
@@ -5,6 +7,8 @@ export declare class AladoServer {
5
7
  private readonly server;
6
8
  private readonly openApiDocObject;
7
9
  private port;
10
+ private host;
11
+ private backlog;
8
12
  private readonly logger?;
9
13
  constructor(options: AladoServerOptions);
10
14
  get(path: string, context: Context<any>, handler: (request: any) => Response<any> | Promise<Response<any>>): void;
@@ -13,6 +17,6 @@ export declare class AladoServer {
13
17
  patch(path: string, context: Context<any>, handler: (request: any) => Response<any> | Promise<Response<any>>): void;
14
18
  delete(path: string, context: Context<any>, handler: (request: any) => Response<any> | Promise<Response<any>>): void;
15
19
  head(path: string, context: Context<any>, handler: (request: any) => Promise<Response<any>>): void;
16
- start(cb: () => void): void;
17
- stop(cb: (error?: Error) => void): void;
20
+ start(cb?: (err?: Error) => void): Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
21
+ stop(cb: (error?: Error) => void): Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
18
22
  }
@@ -10,6 +10,8 @@ class AladoServer {
10
10
  server;
11
11
  openApiDocObject;
12
12
  port;
13
+ host;
14
+ backlog;
13
15
  logger;
14
16
  constructor(options) {
15
17
  (0, _helper_1.validateAladoOptions)(options);
@@ -30,6 +32,8 @@ class AladoServer {
30
32
  logger: this.logger,
31
33
  }, this.openApiDocObject);
32
34
  this.port = options.port;
35
+ this.host = options.host || _const_1.defaultHost;
36
+ this.backlog = options.backlog || _const_1.defaultBacklog;
33
37
  this.server = (0, _factory_1.httpServerFactory)({
34
38
  router: this.router,
35
39
  openApiDoc: options.openApiDoc,
@@ -56,10 +60,10 @@ class AladoServer {
56
60
  this.router.use(_const_1.HttpMethod.HEAD, path, context, handler);
57
61
  }
58
62
  start(cb) {
59
- this.server.listen(this.port, cb);
63
+ return this.server.listen(this.port, this.host, this.backlog, cb);
60
64
  }
61
65
  stop(cb) {
62
- this.server.close(cb);
66
+ return this.server.close(cb);
63
67
  }
64
68
  }
65
69
  exports.AladoServer = AladoServer;
@@ -1 +1 @@
1
- {"version":3,"file":"alado-server.js","sourceRoot":"","sources":["../../src/alado-server/alado-server.ts"],"names":[],"mappings":";;;AAEA,mCAA6D;AAG7D,qCAAiC;AACjC,uCAA6C;AAC7C,qCAA2D;AAE3D,MAAa,WAAW;IACL,MAAM,CAAS;IACf,MAAM,CAAS;IACf,gBAAgB,CAAM;IAC/B,IAAI,CAAS;IACJ,MAAM,CAAqB;IAE5C,YAAY,OAA2B;QACrC,IAAA,8BAAoB,EAAC,OAAO,CAAC,CAAC;QAC9B,IAAI,OAAO,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC;YAC9B,OAAO,CAAC,UAAU,CAAC,KAAK,GAAG,GAAG,IAAA,oBAAU,EAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACvE,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAK,OAA6B,CAAC;QAC/D,IAAI,CAAC,gBAAgB,GAAG,EAAE,GAAG,gCAAuB,EAAE,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC;QAC7F,IAAI,CAAC,MAAM,GAAG,IAAI,gBAAM,CACtB;YACE,IAAI,EAAE;gBACJ,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM;gBAC5B,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,IAAI,GAAG;gBAClD,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,IAAI,EAAE;gBACnD,cAAc,EAAE,IAAI,GAAG,EAAY;gBACnC,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,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IAC3D,CAAC;IAEM,GAAG,CAAC,IAAY,EAAE,OAAqB,EAAE,OAAiE;QAC/G,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAU,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,IAAY,EAAE,OAAqB,EAAE,OAAiE;QACjH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAU,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAEM,MAAM,CACX,IAAY,EACZ,OAAqB,EACrB,OAAiE;QAEjE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAU,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAEM,IAAI,CAAC,IAAY,EAAE,OAAqB,EAAE,OAAiD;QAChG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,EAA0B;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,CAAC,EAA2B;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;CACF;AA/ED,kCA+EC"}
@@ -0,0 +1,2 @@
1
+ export declare const defaultHost: string;
2
+ export declare const defaultBacklog: number;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultBacklog = exports.defaultHost = void 0;
4
+ exports.defaultHost = '0.0.0.0';
5
+ exports.defaultBacklog = 2048;
6
+ //# sourceMappingURL=http-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-server.js","sourceRoot":"","sources":["../../src/constants/http-server.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAW,SAAS,CAAC;AAChC,QAAA,cAAc,GAAW,IAAI,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export * from './content-type';
2
2
  export * from './default-doc-object';
3
3
  export * from './http-method';
4
+ export * from './http-server';
4
5
  export * from './http-status';
5
6
  export * from './reg-exp';
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./content-type"), exports);
18
18
  __exportStar(require("./default-doc-object"), exports);
19
19
  __exportStar(require("./http-method"), exports);
20
+ __exportStar(require("./http-server"), exports);
20
21
  __exportStar(require("./http-status"), exports);
21
22
  __exportStar(require("./reg-exp"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,uDAAqC;AACrC,gDAA8B;AAC9B,gDAA8B;AAC9B,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,uDAAqC;AACrC,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,4CAA0B"}
@@ -5,6 +5,8 @@ import { CorsOptions } from './cors-options';
5
5
  import { SecureContextOptions } from 'tls';
6
6
  export interface AladoServerOptions {
7
7
  port: number;
8
+ host?: string;
9
+ backlog?: number;
8
10
  cors: CorsOptions;
9
11
  openApiDoc: OpenApiDoc;
10
12
  ssl?: SecureContextOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alado",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "Extremely fast, lightweight, robust framework for HTTP applications written in Node.js",
5
5
  "keywords": [
6
6
  "HTTP",
@@ -50,7 +50,7 @@
50
50
  "url": "https://github.com/databikers/alado/issues"
51
51
  },
52
52
  "homepage": "https://github.com/databikers/alado",
53
- "engines" : {
54
- "node" : ">=16.0.0"
53
+ "engines": {
54
+ "node": ">=16.0.0"
55
55
  }
56
56
  }