@atlantjs/backend 11.0.26 → 11.0.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlantjs/backend",
3
- "version": "11.0.26",
3
+ "version": "11.0.27",
4
4
  "main": "index.js",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -11,7 +11,6 @@ const routing_controllers_1 = require("routing-controllers");
11
11
  const body_parser_theta_1 = require("./body-parser-theta");
12
12
  const cors_theta_1 = require("./cors-theta");
13
13
  const default_error_handler_theta_1 = require("./default-error-handler-theta");
14
- const signale_1 = __importDefault(require("signale"));
15
14
  class Server {
16
15
  static initialize(ports) {
17
16
  Server.instance.disable("x-powered-by");
@@ -22,14 +21,15 @@ class Server {
22
21
  Server.instance.use(body_parser_theta_1.BodyParserTheta.create());
23
22
  Server.instance.use(default_error_handler_theta_1.DefaultErrorHandlerTheta.create());
24
23
  (0, routing_controllers_1.useExpressServer)(Server.instance, Server.routingOptions);
25
- let portsListened = [];
26
24
  for (const port of ports) {
27
- if (portsListened.includes(port)) {
28
- signale_1.default.warn(`Port ${port} is already being listened to. Skipping...`);
29
- continue;
30
- }
31
- Server.instance.listen(port);
32
- portsListened.push(port);
25
+ Server.instance.listen(port).on('error', (error) => {
26
+ if (error.code === 'EADDRINUSE') {
27
+ console.warn(`Port ${port} is already in use, skipping...`);
28
+ }
29
+ else {
30
+ throw error;
31
+ }
32
+ });
33
33
  }
34
34
  return Server.instance;
35
35
  }