Skip to content

Commit

Permalink
#fix: thuanvv fix cors
Browse files Browse the repository at this point in the history
  • Loading branch information
VanThuan76 committed Jan 11, 2025
1 parent 31b5b45 commit 6f1ab06
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/web/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import dotenv from 'dotenv';
import cors from '@fastify/cors';
import Fastify from 'fastify';

import app from './app';
Expand All @@ -12,6 +13,12 @@ async function start() {
},
});

await fastify.register(cors, {
origin: '*',
methods: ['GET', 'POST', 'PUT', 'DELETE'],
allowedHeaders: ['Content-Type', 'Authorization'],
});

await app(fastify);

const applicationConfig = fastify.diContainer.cradle.config;
Expand Down

0 comments on commit 6f1ab06

Please sign in to comment.