title: Duplicate console log
body: <p>I'm not sure why but this line of code (towards the bottom)</p>
  
  <pre><code>console.log(user_location);//this prints out 2 console responses
  </code></pre>
  
  <p>within this code</p>
  
  <pre><code>    var net = require('net');
  var express = require('express');
  var app = express();
  var port = process.env.PORT || 8000;
  
  // require request-ip and register it as middleware
  var requestIp = require('request-ip');
  
  // to convert the ip into geolocation coords
  var geoip2 = require('geoip2');
  
  // you can override which attirbute the ip will be set on by
  // passing in an options object with an attributeName
  app.use(requestIp.mw({ attributeName : 'myCustomAttributeName' }));
  
  // respond to all requests
  app.use(function(req, res) {
  
      // use our custom attributeName that we registered in the middleware
      //var ip = req.myCustomAttributeName;
      var ip = '207.97.227.239';
      //console.log(ip);
      //console.log('requestip ip is:  ' + ip);
  
      // https://nodejs.org/api/net.html#net_net_isip_input
      var ipType = net.isIP(ip); // returns 0 for invalid, 4 for IPv4, and 6 for IPv6
      res.end('Hello, your ip address is ' + ip + ' and is of type IPv' + ipType + '\n');
  
      //geoip2
      geoip2.init();// init the db
      //console.log(ip);
          geoip2.lookupSimple(ip, function(error, result) {//67.183.57.64, 207.97.227.239
              var user_location = result.city;
            if (error) {
              console.log("Error: %s", error);
            }
            else if (user_location) {//replaced result with user_location
              console.log(user_location);//this prints out 2 console responses
            }
          });
  });
  </code></pre>
  
  <p>I'm not sure why its printing the <code>user_location</code> twice in the console... I'm somewhat new to nodejs... so I'm not sure why this is happening... can someone with more knowledge of nodejs can point out what I'm doing wrong?</p>