Update index.js
Browse files
index.js
CHANGED
@@ -71,10 +71,21 @@ app.use("/api/v1/", apiLimiter);
|
|
71 |
app.disable("x-powered-by");
|
72 |
app.disable("link")
|
73 |
|
|
|
|
|
|
|
|
|
74 |
app.use(cors({
|
75 |
-
origin:
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
methods: ['GET', 'POST'],
|
77 |
allowedHeaders: ['Content-Type', 'Authorization', 'x-api-key'],
|
|
|
78 |
}));
|
79 |
|
80 |
app.use(bodyParser.json());
|
|
|
71 |
app.disable("x-powered-by");
|
72 |
app.disable("link")
|
73 |
|
74 |
+
const allowedOrigins = [
|
75 |
+
'https://randydev-ryu-js.hf.space',
|
76 |
+
];
|
77 |
+
|
78 |
app.use(cors({
|
79 |
+
origin: (origin, callback) => {
|
80 |
+
if (allowedOrigins.includes(origin)) {
|
81 |
+
callback(null, true);
|
82 |
+
} else {
|
83 |
+
callback(new Error('Not allowed by CORS'));
|
84 |
+
}
|
85 |
+
},
|
86 |
methods: ['GET', 'POST'],
|
87 |
allowedHeaders: ['Content-Type', 'Authorization', 'x-api-key'],
|
88 |
+
credentials: true,
|
89 |
}));
|
90 |
|
91 |
app.use(bodyParser.json());
|