Skip to content

Instantly share code, notes, and snippets.

@fantasywind
Created March 22, 2017 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fantasywind/2775399d495973cd0c411a8be9340216 to your computer and use it in GitHub Desktop.
Save fantasywind/2775399d495973cd0c411a8be9340216 to your computer and use it in GitHub Desktop.
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");
if (req.method === 'OPTIONS') {
res.status(204);
res.end();
} else {
next();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment