title: Node "req is not defined"
body: <p>When I try to start following script:</p>
  
  <pre><code>var http = require("http");
  
  http.createServer(function(request, response) {
    response.writeHead(200, {"Content-Type": "text/plain"});
    response.write("Hello World");
    response.end();
  }).listen(8000);
  
  var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
  
  console.log(ip)
  </code></pre>
  
  <p>I get following Error:</p>
  
  <pre><code>node.js:201
          throw e; // process.nextTick error, or 'error' event on first tick
                ^
  ReferenceError: req is not defined
      at Object.&lt;anonymous&gt; (/home/ubuntu/IPDeliverer/server.js:9:10)
      at Module._compile (module.js:441:26)
      at Object..js (module.js:459:10)
      at Module.load (module.js:348:32)
      at Function._load (module.js:308:12)
      at Array.0 (module.js:479:10)
      at EventEmitter._tickCallback (node.js:192:41)
  </code></pre>
  
  <p>My first guess was, that there is some module missing, so I installed the following module like this:</p>
  
  <pre><code>npm install req
  </code></pre>
  
  <p>and then I included following line </p>
  
  <pre><code>var req = require("./node_modules/req/node_modules/request");
  </code></pre>
  
  <p>but it is still not working. Any suggestions ?</p>