adding cors 2

This commit is contained in:
Adolfo Reyna
2021-07-20 09:57:30 -07:00
parent dcd161aac8
commit 34be604e15
3 changed files with 26 additions and 6 deletions

View File

@@ -5,17 +5,14 @@ const app = express();
const port = process.env.PORT || 3000;
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const cors = require('cors');
app.use(cors());
app.options('*', cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*"); // update to match the domain you will make the request from
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
const bcrypt = require('bcrypt');
const crypto = require('crypto');
const DB = require("./mongoDB.js");