Skip to content

Commit

Permalink
Use manual CORS setting
Browse files Browse the repository at this point in the history
  • Loading branch information
mmahdigh committed Oct 25, 2023
1 parent 3fd45ca commit e331da6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@ async function bootstrap() {
// app.enableCors();
// app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
app.useGlobalPipes(new ValidationPipe({ transform: true }));
app.use(cors());
// app.use(cors());

app.use((req: any, res: any) => {
res.header('Access-Control-Allow-Origin', '*');
res.header(
'Access-Control-Allow-Headers',
'Content-Type,Content-Length, Authorization, Accept,X-Requested-With, Auth',
);
res.header('Access-Control-Allow-Methods', 'PUT,POST,GET,DELETE,OPTIONS');
//...
});

// app.use(
// cors({
// credentials: true,
Expand Down

0 comments on commit e331da6

Please sign in to comment.