Skip to content

Instantly share code, notes, and snippets.

@justforuse
Last active February 17, 2020 14:40
Show Gist options
  • Save justforuse/a2347d6133042caa984aea7d5fcc67a5 to your computer and use it in GitHub Desktop.
Save justforuse/a2347d6133042caa984aea7d5fcc67a5 to your computer and use it in GitHub Desktop.
Express cross origin headers
app.all('*', function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "X-Requested-With");
  res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
  res.header("X-Powered-By",' 3.2.1')
  res.header("Content-Type", "application/json;charset=utf-8");
  next();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment