Skip to content

Commit

Permalink
Add cors package and configure cors in app.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
cruizba committed Oct 16, 2023
1 parent 42f1d7e commit 90d9950
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
35 changes: 35 additions & 0 deletions openvidu-call-back/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion openvidu-call-back/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dependencies": {
"chalk": "4.1.2",
"cookie-parser": "1.4.6",
"cors": "2.8.5",
"dotenv": "16.0.3",
"express": "4.18.2",
"http-proxy-middleware": "2.0.6",
Expand Down Expand Up @@ -39,4 +40,4 @@
"dev:start": "cross-env CALL_OPENVIDU_CERTTYPE=selfsigned nodemon src/app.ts"
},
"version": "2.28.0"
}
}
8 changes: 8 additions & 0 deletions openvidu-call-back/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as cookieParser from 'cookie-parser';
import * as dotenv from 'dotenv';
import * as express from 'express';
import * as cors from 'cors';
import { app as authController } from './controllers/AuthController';
import { app as broadcastController } from './controllers/BroadcastController';
import { app as callController } from './controllers/CallController';
Expand All @@ -27,6 +28,13 @@ const authService = AuthService.getInstance();
dotenv.config();
const app = express();

// Allow cors by default
// Modify this if you want to restrict access to the server
app.use(
cors({
origin: '*',
})
);
app.use(express.static(__dirname + '/public'));
app.use(express.json());
app.use(cookieParser());
Expand Down

0 comments on commit 90d9950

Please sign in to comment.