diff --git a/server/server.js b/server/server.js index 4ac78cc..08dbae4 100644 --- a/server/server.js +++ b/server/server.js @@ -6,6 +6,7 @@ import MatchController from "./controllers/matchController.js"; import SportController from "./controllers/sportController.js"; import { userSession } from "./middleware/authority.js"; import { mongooseDbName, mongoURI } from "./database/mongoose.js"; +import cors from "cors"; const server = express(); const port = process.env.PORT || 5000; @@ -23,8 +24,11 @@ try { console.error(error); } + if (process.env.NODE_ENV === "development") { mongoose.set("bufferCommands", false); // We want to know if there are connection issues immediately for development. Disables globally. + + server.use(cors()); } // Docs: https://www.npmjs.com/package/body-parser