V
V
vasIvas2015-11-28 18:10:49
Node.js
vasIvas, 2015-11-28 18:10:49

How to correctly set cors for all paths in express?

How to set cors for all routers at once?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
s2dent, 2015-12-13
@s2dent

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();
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question