Skip to content

Instantly share code, notes, and snippets.

@utimur
Created August 12, 2020 14:16
Show Gist options
  • Save utimur/302cb2cd996fce5ed32a4519aa8ea575 to your computer and use it in GitHub Desktop.
Save utimur/302cb2cd996fce5ed32a4519aa8ea575 to your computer and use it in GitHub Desktop.
Express js CORS
function cors(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "GET, PUT, PATCH, POST, DELETE");
res.header("Access-Control-Allow-Headers", "Content-Type");
next();
}
module.exports = cors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment