Node.js TypeError: Parameter 'url' must be a string, not undefined
<p>Im trying to parse some urls using url module and http server.</p>

<p>Code bellow:</p>

<pre><code>var http = require('http');
var URL = require('url');
var port = 8080;

var server = http.createServer(function(req, res) {
    var parsedURL = URL.parse(req.URL, true).pathname;
    switch(parsedURL) {
        case 'test/myurl':
            console.log('Valid URL.');
            break;
        default:
            console.log('404!')
    }
});

server.listen(port);
console.log('Service at port: ' + port);
</code></pre>

<p>gives following error:</p>

<pre><code>TypeError: Parameter 'url' must be a string, not undefined
</code></pre>

<p>at this line:</p>

<pre><code>var parsedURL = URL.parse(req.URL, true).pathname;
</code></pre>

<p>Anyone can help? Any explanation would be appreciated.</p>