qumra-engine 2.0.109 → 2.0.111
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/dist/middleware.js +4 -10
- package/package.json +1 -1
package/dist/middleware.js
CHANGED
|
@@ -25,20 +25,14 @@ const cors_1 = __importDefault(require("cors"));
|
|
|
25
25
|
const startEngine = async ({ renderApi, mode, getRender, setRender, port = 3000, themesRepo, themeId = null, currentApp, market, }) => {
|
|
26
26
|
try {
|
|
27
27
|
const app = (0, express_1.default)();
|
|
28
|
+
app.use((0, cors_1.default)({
|
|
29
|
+
origin: "*",
|
|
30
|
+
}));
|
|
28
31
|
app.use((0, cookie_parser_1.default)());
|
|
29
32
|
app.set("view engine", "nunjucks");
|
|
30
33
|
app.use((0, morgan_1.default)("dev"));
|
|
31
|
-
app.use((0, cors_1.default)({
|
|
32
|
-
origin: (origin, callback) => {
|
|
33
|
-
callback(null, origin || "*");
|
|
34
|
-
// لو فيه origin بيرجعه، لو مش فيه (زي Postman) بيرجع "*"
|
|
35
|
-
},
|
|
36
|
-
credentials: true, // مهم لو هتستخدم كوكيز أو Authorization
|
|
37
|
-
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|
|
38
|
-
allowedHeaders: ["Content-Type", "Authorization"],
|
|
39
|
-
}));
|
|
40
34
|
// لازم ترد على preflight OPTIONS request
|
|
41
|
-
app.options("*", (
|
|
35
|
+
// app.options("*", cors());
|
|
42
36
|
app.get("/health", (req, res) => {
|
|
43
37
|
console.log("🚀 Health check OK");
|
|
44
38
|
res.status(200).send("OK");
|