ismx-nexo-node-app 0.4.166 → 0.4.171
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,21 @@ 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((
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
const express = yield Promise.resolve().then(() => __importStar(require("express"))).then((e) => e.default).catch(() => null);
|
|
50
|
+
const cors = yield Promise.resolve().then(() => __importStar(require("cors"))).then((e) => e.default).catch(() => null);
|
|
51
|
+
if (!express || !cors)
|
|
52
|
+
return;
|
|
53
|
+
this.express = express;
|
|
54
|
+
this.app = express();
|
|
55
|
+
this.app.use(express.urlencoded({ extended: false }));
|
|
56
|
+
this.app.use(cors({
|
|
57
|
+
origin: true,
|
|
58
|
+
methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
|
|
59
|
+
allowedHeaders: ["Authorization", "Content-Type"],
|
|
60
|
+
exposedHeaders: ["Authorization"],
|
|
61
|
+
credentials: false
|
|
56
62
|
}));
|
|
63
|
+
this.app.options("*", cors());
|
|
57
64
|
});
|
|
58
65
|
}
|
|
59
66
|
start(port) {
|
package/package.json
CHANGED
|
@@ -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);
|
|
38
|
+
console.log(logMessage);this.writeToFile(logMessage);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
i(message: string) {
|
|
@@ -15,15 +15,25 @@ export default class BusinessServer extends Business
|
|
|
15
15
|
this.publish = this.publish.bind(this);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
async init()
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
async init()
|
|
19
|
+
{
|
|
20
|
+
const express = await import("express").then((e) => e.default).catch(() => null);
|
|
21
|
+
const cors = await import("cors").then((e) => e.default).catch(() => null);
|
|
22
|
+
if (!express || !cors) return;
|
|
23
|
+
|
|
24
|
+
this.express = express;
|
|
25
|
+
this.app = express();
|
|
26
|
+
|
|
27
|
+
this.app.use(express.urlencoded({ extended: false }));
|
|
28
|
+
this.app.use(cors({
|
|
29
|
+
origin: true,
|
|
30
|
+
methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
|
|
31
|
+
allowedHeaders: ["Authorization", "Content-Type"],
|
|
32
|
+
exposedHeaders: ["Authorization"],
|
|
33
|
+
credentials: false
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
this.app.options("*", cors());
|
|
27
37
|
}
|
|
28
38
|
|
|
29
39
|
start(port: number) {
|