Skip to content

Commit

Permalink
feat: add cors
Browse files Browse the repository at this point in the history
  • Loading branch information
chauanhtuan185 authored Oct 30, 2024
1 parent 9f2f12c commit 494eff4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import postRouter from "./routes/api";

const cors = require('cors');
const express = require('express');
const swaggerUi = require('swagger-ui-express');
const swaggerJsDoc = require('swagger-jsdoc');

const app = express();
const port = process.env.PORT || 3000;
const port = process.env.PORT || 3001;
app.use(cors());

app.use(cors({
origin: 'http://localhost:3000'
}));

const options = {
definition: {
Expand All @@ -32,4 +37,4 @@ app.use('/api/answer', postRouter)

app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}`);
});
});

0 comments on commit 494eff4

Please sign in to comment.