Added CORS for development environment.
This commit is contained in:
parent
8a3de628a6
commit
c345cea888
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user