Advertisement
x7f

Express Cors

x7f
Nov 16th, 2020
1,215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var express = require('express');
  2. var app = express();
  3.  
  4. app.options("/*", function(req, res, next){
  5.   res.header('Access-Control-Allow-Origin', '*');
  6.   res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
  7.   res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With');
  8.   res.send(200);
  9. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement