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 6f1ab06 commit 89dd432
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/web/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export default async function makeApp(fastify: FastifyInstance) {

// Configure CORS
await fastify.register(Cors, {
origin: false, // TODO: Set this to a valid origin
origin: '*',
methods: ['GET', 'POST', 'PUT', 'DELETE'],
allowedHeaders: ['Content-Type', 'Authorization'],
});

// Auto-load plugins
Expand Down
7 changes: 0 additions & 7 deletions src/web/server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import dotenv from 'dotenv';
import cors from '@fastify/cors';
import Fastify from 'fastify';

import app from './app';
Expand All @@ -13,12 +12,6 @@ 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 89dd432

Please sign in to comment.