adding cors 2
This commit is contained in:
9
index.js
9
index.js
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user