title: compoundjs support both ssl and normal http
body: <p>I needed to use SSL on my site in certain situations, </p>
  
  <p>I have followed the example in the readme </p>
  
  <pre><code>require('compound').createServer({
      key: fs.readFileSync('/tmp/tls.key').toString(),
      cert: fs.readFileSync('/tmp/tls.cert').toString()
  });
  </code></pre>
  
  <p>My server.js is </p>
  
  <pre><code>#!/usr/bin/env node
  var fs = require('fs');
  /**
   * Server module exports method returning new instance of app.
   *
   * @param {Object} params - compound/express webserver initialization params.
   * @returns CompoundJS powered express webserver
   */
  var app = module.exports = function getServerInstance(params) {
      params = params || {};
      // specify current dir as default root of server
      params.root = params.root || __dirname;
      params["key"] = fs.readFileSync('/tmp/tls.key').toString();
      params["cert"] =  fs.readFileSync('/tmp/tls.cert').toString();
      return require('compound').createServer(params);
  };
  
  if (!module.parent) {
      var port = process.env.PORT || 3000;
      var host = process.env.HOST || '0.0.0.0';
  
      var server = app();
      server.listen(port, host, function () {
          console.log(
              'Compound server listening on %s:%d within %s environment',
              host, port, server.set('env')
          );
      });
  }
  </code></pre>
  
  <p>Now the problem is I can't get http, only https. 
  If I just put my cert and key inside of the config folder and have</p>
  
  <pre><code>**var app = module.exports = function getServerInstance(params) {
      params = params || {};
      // specify current dir as default root of server
      params.root = params.root || __dirname;
      return require('compound').createServer(params);
  };**
  </code></pre>
  
  <p>Then I get some error that </p>
  
  <pre><code>config/tls.cert:1
  tion (exports, require, module, __filename, __dirname) { -----BEGIN CERTIFICAT
                                                                      ^^^^^^^^^^^
  SyntaxError: Unexpected identifier
      at Module._compile (module.js:439:25)
  </code></pre>
  
  <p>What is the quickest and easiest way to get compoundjs to support both https and http routes, do I need to have two servers (like you would often with straight express)?</p>