🔒 CORS configuration in docker-compose and Express

This commit is contained in:
2021-10-18 12:11:30 -07:00
parent 8b3743fe6b
commit 2d1ccf7264
5 changed files with 14 additions and 21 deletions

View File

@@ -3,13 +3,20 @@ import bodyParser from "body-parser";
import { createServer } from "http";
import { Server } from "socket.io";
import router from "./route";
import cors from "cors";
const amqp = require("amqplib/callback_api");
// call express
const app: Express = express(); // define our app using express
app.use(cors({ origin: "*" }));
const httpServer = createServer();
export const io = new Server(httpServer, {});
export const io = new Server(httpServer, {
cors: {
origin: "*",
methods: ["GET", "POST"],
}
});
// configure app to use bodyParser for
// Getting data from body of requests