Created
December 30, 2014 11:32
-
-
Save ubergoober/6e1f05f4a16c7f617c89 to your computer and use it in GitHub Desktop.
Express Node Server CORS
This file contains hidden or 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
| var app = express(); | |
| app.use(function (req, res, next) { | |
| res.setHeader('Access-Control-Allow-Origin', req.headers.origin); | |
| res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE'); | |
| res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type'); | |
| next(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment