title: Allow multiple CORS domain in express js
body: <p>How do I allow multiple domains for CORS in express in a simplified way.</p>
  
  <p>I have</p>
  
  <pre><code> cors: {
          origin: "www.one.com";
      }
  
      app.all('*', function(req, res, next) {
              res.header("Access-Control-Allow-Origin", cors.origin);
              res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
              next();
          });
  </code></pre>
  
  <p>This works when there is only one domain mentioned in <code>origin</code></p>
  
  <p>But if I want to have <code>origin</code> as an array of domains and I want to allow CORS for all the domains in the origin array, I would have something like this - </p>
  
  <pre><code>cors: {
              origin: ["www.one.com","www.two.com","www.three.com"];
          }
  </code></pre>
  
  <p>But then the problem is this below code would not work - </p>
  
  <pre><code>app.all('*', function(req, res, next) {
                  res.header("Access-Control-Allow-Origin", cors.origin);
                  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
                  next();
              });
  </code></pre>
  
  <p>How do I make <code>res.header</code> take an array of domains via <code>cors.origin</code> ?</p>