Node.js TLS " TypeError: Cannot read property 'indexOf' of undefined"
<p>I use nodejs 5.9.0 and express. In my code, I create the server this way:</p>

<pre><code>var app = express();

var tls = require('tls');
var fs = require('fs');
var options = {
  key: fs.readFileSync('key.pem'),
  cert: fs.readFileSync('cert.pem')
};
tls.createServer(options, app).listen(3000);

var http = require('http');
http.createServer(app).listen(80);
</code></pre>

<p>HTTP works fine. But when I tried to access <a href="https://localhost:3000" rel="nofollow">https://localhost:3000</a>, it throws below exception: </p>

<pre><code>C:\src\nodejs\videos\node_modules\express\lib\router\index.js:140
  var search = 1 + req.url.indexOf('?');
                          ^

TypeError: Cannot read property 'indexOf' of undefined
    at Function.handle (C:\src\nodejs\videos\node_modules\express\lib\router\index.js:140:27)
    at EventEmitter.handle (C:\src\nodejs\videos\node_modules\express\lib\application.js:173:10)
    at Server.app (C:\src\nodejs\videos\node_modules\express\lib\express.js:38:9)
    at emitOne (events.js:90:13)
    at Server.emit (events.js:182:7)
    at TLSSocket.&lt;anonymous&gt; (_tls_wrap.js:817:14)
    at emitNone (events.js:80:13)
    at TLSSocket.emit (events.js:179:7)
    at TLSSocket._init.ssl.onclienthello.ssl.oncertcb.TLSSocket._finishInit (_tls_wrap.js:593:8)
    at TLSSocket.onhandshakedone (_tls_wrap.js:65:8)
 Program node bin/www exited with code 1
</code></pre>

<p>Did I use nodejs TLS and express the correct way?</p>