Skip to content

Instantly share code, notes, and snippets.

@Lazhari
Created July 18, 2015 05:19
Show Gist options
  • Save Lazhari/f4896ff01740a9c543d5 to your computer and use it in GitHub Desktop.
Save Lazhari/f4896ff01740a9c543d5 to your computer and use it in GitHub Desktop.
Enable CORS on Expressjs
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE");
res.header("Access-Control-Allow-Headers", "Content-Type, Authorization");
next();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment