ismx-nexo-node-app 0.4.166 → 0.4.170

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.
@@ -46,14 +46,19 @@ class BusinessServer extends Business_1.default {
46
46
  }
47
47
  init() {
48
48
  return __awaiter(this, void 0, void 0, function* () {
49
- yield Promise.resolve().then(() => __importStar(require("express"))).then((_a) => __awaiter(this, [_a], void 0, function* ({ default: express }) {
50
- yield Promise.resolve().then(() => __importStar(require("cors"))).then((_a) => __awaiter(this, [_a], void 0, function* ({ default: cors }) {
51
- this.express = express;
52
- this.app = express();
53
- this.app.use(express.urlencoded({ extended: false }));
54
- this.app.use(cors());
55
- }));
49
+ const { default: express } = yield Promise.resolve().then(() => __importStar(require("express")));
50
+ const { default: cors } = yield Promise.resolve().then(() => __importStar(require("cors")));
51
+ this.express = express;
52
+ this.app = express();
53
+ this.app.use(express.urlencoded({ extended: false }));
54
+ this.app.use(cors({
55
+ origin: true,
56
+ methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
57
+ allowedHeaders: ["Authorization", "Content-Type"],
58
+ exposedHeaders: ["Authorization"],
59
+ credentials: false
56
60
  }));
61
+ this.app.options("*", cors());
57
62
  });
58
63
  }
59
64
  start(port) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.4.166",
3
+ "version": "0.4.170",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -35,7 +35,7 @@ export default class BusinessLogger
35
35
 
36
36
  private log(level: string, message: string, writeToFile: boolean = false) {
37
37
  const logMessage = `[${level}] ${new Date().toISOString()} -- ${message}`;
38
- console.log(logMessage); this.writeToFile(logMessage);
38
+ console.log(logMessage);this.writeToFile(logMessage);
39
39
  }
40
40
 
41
41
  i(message: string) {
@@ -15,15 +15,24 @@ export default class BusinessServer extends Business
15
15
  this.publish = this.publish.bind(this);
16
16
  }
17
17
 
18
- async init() {
19
- await import("express").then(async ({ default: express }) => {
20
- await import("cors").then(async ({ default: cors }) => {
21
- this.express = express;
22
- this.app = express();
23
- this.app.use(express.urlencoded({ extended: false }));
24
- this.app.use(cors());
25
- })
26
- });
18
+ async init()
19
+ {
20
+ const { default: express } = await import("express");
21
+ const { default: cors } = await import("cors");
22
+
23
+ this.express = express;
24
+ this.app = express();
25
+
26
+ this.app.use(express.urlencoded({ extended: false }));
27
+ this.app.use(cors({
28
+ origin: true,
29
+ methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
30
+ allowedHeaders: ["Authorization", "Content-Type"],
31
+ exposedHeaders: ["Authorization"],
32
+ credentials: false
33
+ }));
34
+
35
+ this.app.options("*", cors());
27
36
  }
28
37
 
29
38
  start(port: number) {