title: How to make a external API call inside express server?
body: <p>Hello I ve been trying to implement OneSignal API on my dashboard and I wonder if it is possible to make a API external call inside express server.</p>
  
  <p>Here is an example: </p>
  
  <pre><code>var sendNotification = function(data) {
    var headers = {
      "Content-Type": "application/json; charset=utf-8",
      "Authorization": "Basic NGEwMGZmMjItY2NkNy0xMWUzLTk5ZDUtMDAwYzI5NDBlNjJj"
    };
  
    var options = {
      host: "onesignal.com",
      port: 443,
      path: "/api/v1/notifications",
      method: "POST",
      headers: headers
    };
  
    var https = require('https');
    var req = https.request(options, function(res) {  
      res.on('data', function(data) {
        console.log("Response:");
        console.log(JSON.parse(data));
      });
    });
  
    req.on('error', function(e) {
      console.log("ERROR:");
      console.log(e);
    });
  
    req.write(JSON.stringify(data));
    req.end();
  };
  </code></pre>
  
  <p>Here it is the app route</p>
  
  <pre><code>app.post('/path', function(req, res){
  
  
  var message = { 
    app_id: "5eb5a37e-b458-11e3-ac11-000c2940e62c",
    contents: {"en": "English Message"},
    included_segments: ["All"]
  };
  
  sendNotification(message);
  });
  </code></pre>
  
  <p>Thank you!</p>