Created
October 30, 2016 17:24
-
-
Save wizardnet972/69031008e8ad443d9b88d05e4a40f2da to your computer and use it in GitHub Desktop.
CORS on ExpressJS
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
app.use(function(req, res, next) { | |
res.header("Access-Control-Allow-Origin", "*"); | |
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); | |
next(); | |
}); | |
app.get('/', function(req, res, next) { | |
// Handle the get for this route | |
}); | |
app.post('/', function(req, res, next) { | |
// Handle the post for this route | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment