Skip to content

Commit 0cf2456

Browse files
committed
cors added
1 parent 6d9ebed commit 0cf2456

File tree

5 files changed

+61
-1
lines changed

5 files changed

+61
-1
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/node_module
1+
/node_modules
22
.env

node_modules/.package-lock.json

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"author": "",
1313
"license": "ISC",
1414
"dependencies": {
15+
"cors": "^2.8.5",
1516
"dotenv": "^16.0.3",
1617
"express": "^4.18.2",
1718
"mongoose": "^6.9.1"

server.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
require("dotenv").config();
22
const express = require("express");
3+
const cors=require('cors')
34
const mongoose = require("mongoose");
45
const projectRoutes = require("./routes/projectRoutes");
6+
57
const app = express();
68

79
//port
810
const port = process.env.PORT || 4000;
911

1012
//midlewares
13+
1114
app.use(express.json());
15+
app.use(cors())
1216
app.use((req, res, next) => {
1317
console.log(req.method, req.url);
1418
next();

0 commit comments

Comments
 (0)