Skip to content

Commit

Permalink
REFACT :: CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
gurdl0525 committed Jun 5, 2024
1 parent 7169c2b commit b18ce33
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
31 changes: 29 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,49 @@ async function bootstrap() {
app.enableCors({
credentials: true,
origin: ['http://localhost:3000'],
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS',
methods: ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE', 'OPTIONS'],
allowedHeaders: [
'content-type',
'Content-Type',
'oa-token',
'OA-TOKEN',
'content-length',
'Content-Length',
'x-requested-with',
'X-Requested-With',
'accept',
'Accept',
'accept-encoding',
'Accept-Encoding',
'accept-language',
'Accept-Language',
'accept-headers',
'Accept-Headers',
'user-agent',
'User-Agent',
'host',
'Host',
'connection',
'Connection',
'authorization',
'Authorization',
],
exposedHeaders: ['Authorization', 'OA-TOKEN', 'Location'],
exposedHeaders: [
'Authorization',
'authorization',
'OA-TOKEN',
'oa-token',
'Location',
'location',
'access-control-allow-origin',
'Access-Control-Allow-Origin',
'access-control-allow-headers',
'Access-Control-Allow-Headers',
'access-control-allow-methods',
'Access-Control-Allow-Methods',
'access-control-allow-credentials',
'Access-Control-Allow-Credentials',
],
});

const port = Number(process.env.PORT);
Expand Down
2 changes: 1 addition & 1 deletion src/presentation/tip/tip.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class TipController {
.sendStatus(200);
}

@Get('/search?')
@Get('/search')
async searchTip(
@Headers('Authorization') token: string,
@Query() dto: SearchTipRequest,
Expand Down

0 comments on commit b18ce33

Please sign in to comment.