Created
August 12, 2020 14:16
-
-
Save utimur/302cb2cd996fce5ed32a4519aa8ea575 to your computer and use it in GitHub Desktop.
Express js CORS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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