anton-yarchuk
3/13/2020 - 11:13 AM

express-cors-example

const cors = require('cors');
const app = express();
app.use(cors({origin: true}));
app.use(function (req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Methods", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  next();
});