Skip to content

Commit

Permalink
try to update middleware using multiple origin
Browse files Browse the repository at this point in the history
  • Loading branch information
Z4nR committed Apr 2, 2024
1 parent 86d88e2 commit 6930587
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions server/src/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('dotenv').config();
const express = require('express'),
cors = require('cors'),
bodyParser = require('body-parser'),
Expand All @@ -7,8 +8,6 @@ const app = express(),
route = require('./routes');
const { deleteAllTestData } = require('./controllers/data-controller');

require('dotenv').config();

const env = process.env.NODE_ENV;
const port = process.env.PORT || 5000;

Expand All @@ -19,7 +18,12 @@ if (env === 'development') {

//Middleware
app.use(bodyParser.json());
app.use(cors({ origin: '*', methods: ['GET', 'POST', 'DELETE'] }));
app.use(
cors({
origin: [process.env.URL_LOCAL, process.env.URL_ONLINE],
methods: ['GET', 'POST', 'DELETE'],
})
);

//Delete Daily Schedule
const cronConfig = {
Expand Down

0 comments on commit 6930587

Please sign in to comment.