title: 'Error: self signed certificate' with node+express application
body: <p>Getting the below error</p>
  
  <pre><code>Error: self signed certificate
  at TLSSocket.&lt;anonymous&gt; (_tls_wrap.js:1105:38)
  at emitNone (events.js:106:13)
  at TLSSocket.emit (events.js:208:7)
  at TLSSocket._finishInit (_tls_wrap.js:639:8)
  at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:469:38)
  code: 'DEPTH_ZERO_SELF_SIGNED_CERT',
  </code></pre>
  
  <p>I am running the application in my local system my code is below
  got stuck please help me some one hot to set cors in node.js application i have tried several things</p>
  
  <pre><code>var express = require('express');
  const axios = require('axios');
  var cors = require('cors')
  var app = express();
  app.use(function(req, res, next) {
    res.header('Access-Control-Allow-Origin', req.get('Origin') || '*');
    res.header('Access-Control-Allow-Credentials', 'true');
    res.header('Access-Control-Allow-Methods', 'GET,HEAD,PUT,PATCH,POST,DELETE');
    res.header('Access-Control-Expose-Headers', 'Content-Length');
    res.header('Access-Control-Allow-Headers', 'Accept, Authorization, Content-Type, X-Requested-With, Range');
    if (req.method === 'OPTIONS') {
      return res.send(200);
    } else {
      return next();
    }
  });
  
  app.get('/', function (req, res) {
    res.send('Hello World!');
      axios.get('https://some-ip/api/v1/executions')
    .then(response =&gt; {
      console.log("-=-=-==- inside AXIOS");
      console.log(response.data);
      console.log("-=-=-=-=--=-=-=-=-SUCCESS");
      console.log(response.length);
    })
    .catch(error =&gt; {
      console.log("-=-=-==- inside ERRROR");
      console.log(error);
      console.log("-=-=-=-=--=-=-=-=-=---=-=-=-=--=-=-=-=-ERROR");
  
    });
  });
  app.listen(3000, function () {
    console.log('Example app listening on port 3000!');
  });
  </code></pre>