Skip to content

Instantly share code, notes, and snippets.

@desaijay315
Last active March 29, 2019 11:17
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 desaijay315/fc53fb2f90f79ab1e34608862d1e1814 to your computer and use it in GitHub Desktop.
Save desaijay315/fc53fb2f90f79ab1e34608862d1e1814 to your computer and use it in GitHub Desktop.
var cors = require('cors');
var app = express();
app.use(cors());
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header('Access-Control-Allow-Methods', 'DELETE, PUT, GET, POST');
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment