title: Nodejs Change server HTTP to HTTPS
body: <p>I try change my server to HTTPS, but does not work fine. 
  My page show like I created a new endpoint that returns anything.
  In this case, I have 2 files, app.js with <code>express</code> instantiate and routes, and my server.js to execute the server getting the instance from express.</p>
  
  <p>My app.js (server-side):</p>
  
  <pre><code>const express = require('express'); // app server
  const bodyParser = require('body-parser'); // parser for post requests
  const http = require('http');
  const https = require('https');
  // instance of express
  let app = express();
  
  // endpoints here
  // code .. code with routes, code...
  
  module.exports = app;
  </code></pre>
  
  <p>My server.js (server-side):</p>
  
  <pre><code>const fs = require('fs')
  const server = require('./app');
  const port = process.env.PORT || process.env.VCAP_APP_PORT || 3000;
  
  
  const options = {
    key: fs.readFileSync('certificates/xxx.key'),
    cert: fs.readFileSync('certificates/xxx.cer')
  };
  
  server.listen(port, options, function() {
    console.log('Server execute here %d', port);
  });
  </code></pre>
  
  <p>Maybe is a newbie question, I can have one file with everything on it, but I would like to be more modular. </p>
  
  <p>Someone can help me please, or explain what I did wrong with this case use? </p>