adding cors

This commit is contained in:
Adolfo Reyna
2021-07-20 09:55:19 -07:00
parent cceaa4a64e
commit dcd161aac8
4 changed files with 28 additions and 0 deletions

0
def/content.js Normal file
View File

8
def/group.js Normal file
View File

@@ -0,0 +1,8 @@
User = require("./User.js")
class Gropu extends User {
constructor(){
super()
this.isGroup = true;
}
}

14
def/user.js Normal file
View File

@@ -0,0 +1,14 @@
class User {
constructor(json){
this.username = 'aeroreyna';
this.following = [];
this.lastUpdate = new Date();ß
this.newsFeedCache = [];
this.isGroup = false;
}
newPost(){}
newComment(){}
newReaction(){}
}

View File

@@ -10,6 +10,12 @@ app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser()); 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 bcrypt = require('bcrypt');
const crypto = require('crypto'); const crypto = require('crypto');
const DB = require("./mongoDB.js"); const DB = require("./mongoDB.js");