Skip to content

Commit

Permalink
Merge pull request #26 from bcgov/FSADT1-287-api-gateway
Browse files Browse the repository at this point in the history
Merge: finished test local cors solution, revert code back
  • Loading branch information
MCatherine1994 authored Aug 17, 2022
2 parents c8387ce + 5c3e126 commit e2aed5b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ async function bootstrap() {
const app = await NestFactory.create(AppModule);

// enable cors only for our frontend/backend address
const whitelist = [process.env.FRONTEND_URL, process.env.BACKEND_URL];
app.enableCors({
origin: (origin, callback) => {
if (!origin || whitelist.indexOf(origin) !== -1) {
callback(null, true);
}
// else {
// callback(new Error('Not allowed by CORS'));
// }
},
});

// app.enableCors();
// const whitelist = [process.env.FRONTEND_URL, process.env.BACKEND_URL];
// app.enableCors({
// origin: (origin, callback) => {
// if (!origin || whitelist.indexOf(origin) !== -1) {
// callback(null, true);
// }
// // else {
// // callback(new Error('Not allowed by CORS'));
// // }
// },
// });

app.enableCors();

app.use(bodyParser.json({ limit: '100mb' }));

Expand Down

0 comments on commit e2aed5b

Please sign in to comment.