|
@@ -19,7 +19,20 @@ import './src/utils/Scheduler';
|
19
|
19
|
|
20
|
20
|
const app: Application = express();
|
21
|
21
|
|
22
|
|
-app.use(cors());
|
|
22
|
+const allowedOrigins = [
|
|
23
|
+ 'http://localhost:3006', // frontend local
|
|
24
|
+ 'https://radar-dev.farmagitechs.co.id' // production domain
|
|
25
|
+];
|
|
26
|
+
|
|
27
|
+const corsOptions = {
|
|
28
|
+ origin: allowedOrigins,
|
|
29
|
+ methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],
|
|
30
|
+ allowedHeaders: ['Content-Type', 'Authorization'],
|
|
31
|
+ credentials: true,
|
|
32
|
+};
|
|
33
|
+
|
|
34
|
+app.use(cors(corsOptions));
|
|
35
|
+app.options('*', cors(corsOptions));
|
23
|
36
|
app.use(bodyParser.json());
|
24
|
37
|
app.use(keycloak.middleware());
|
25
|
38
|
app.use(express.json())
|