Skip to content

Commit

Permalink
Added CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
Neglexis committed Feb 21, 2019
1 parent 66cee3c commit fd02f5b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ app.use(
})
);

app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Credentials", true);
res.header("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS");
res.header(
"Access-Control-Allow-Headers",
"Origin,X-Requested-With,Content-Type,Accept,content-type,application/json"
);
next();
});

// connect to db
initializeDb(db => {
// internal middleware
Expand Down

0 comments on commit fd02f5b

Please sign in to comment.