title: Node.js HTTPS Secure Error
body: <p>I am trying to create a secure node.js server to use with my site that is using ssl (https).</p>
  
  <pre><code>const crypto = require('crypto'),
        fs = require("fs"),
        http = require("http");
  
  var privateKey = fs.readFileSync('/home/privatekey.pem');
  var certificate = fs.readFileSync('/home/certificate.pem');
  
  var credentials = crypto.createCredentials({key: privateKey.toString(), cert: certificate.toString()});
  
  var handler = function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
  };
  
  var server = http.createServer();
  server.setSecure(credentials);
  server.addListener("request", handler);
  server.listen(8084);
  </code></pre>
  
  <p>But when I start my server, I get the following error:</p>
  
  <pre><code>node.js:116
          throw e; // process.nextTick error, or 'error' event on first tick
          ^
  TypeError: Object #&lt;Server&gt; has no method 'setSecure'
      at Object.&lt;anonymous&gt; (/home/meshdev/public_html/js/node/server/test.js:16:8)
      at Module._compile (module.js:380:26)
      at Object..js (module.js:386:10)
      at Module.load (module.js:312:31)
      at Function._load (module.js:273:12)
      at Array.&lt;anonymous&gt; (module.js:399:10)
      at EventEmitter._tickCallback (node.js:108:26)
  </code></pre>
  
  <p>My server works great without the <code>server.setSecure(credentials);</code> line. I am running node.js(V0.4.1).</p>
  
  <p>I would appreciate any suggestions.</p>
  
  <p>Thank you.</p>