title: Node.js server generated automatically doesn't start (Swagger/OpenAPI)
body: <p>I have generated a nodejs-server by Swagger Editor, but when I run "npm start" the server doesn't start and return no error.</p>
  
  <p>First time I've run "npm start" all dependencies has been installed, but "node index.js" doesn't start the server.</p>
  
  <p>Second time I've tried "npm start":</p>
  
  <pre class="lang-sh prettyprint-override"><code>dev01@dev01:~/nodejs-server$ npm start
  
  &gt; back-end-rota-exata@1.0.0 prestart /home/dev01/nodejs-server
  &gt; npm install
  
  
  &gt; back-end-rota-exata@1.0.0 start /home/dev01/nodejs-server
  &gt; node index.js
  
  dev01@dev01:~/nodejs-server$ 
  </code></pre>
  
  <p>Then I've tried just "node index.js" too:</p>
  
  <pre class="lang-sh prettyprint-override"><code>dev01@dev01:~/nodejs-server$ node index
  dev01@dev01:~/nodejs-server$ 
  </code></pre>
  
  <p>And nothing happens...</p>
  
  <p>This is the code from "index.js" generated automatically by Swagger Editor:</p>
  
  <pre class="lang-js prettyprint-override"><code>'use strict';
  
  var fs = require('fs'),
      path = require('path'),
      http = require('http');
  
  var app = require('connect')();
  var oas3Tools = require('oas3-tools');
  var jsyaml = require('js-yaml');
  var serverPort = 8080;
  
  // swaggerRouter configuration
  var options = {
    swaggerUi: path.join(__dirname, '/swagger.json'),
    controllers: path.join(__dirname, './controllers'),
    useStubs: process.env.NODE_ENV === 'development' // Conditionally turn on stubs (mock mode)
  };
  
  // The Swagger document (require it, build it programmatically, fetch it from a URL, ...)
  var spec = fs.readFileSync(path.join(__dirname,'api/swagger.yaml'), 'utf8');
  var swaggerDoc = jsyaml.safeLoad(spec);
  
  // Initialize the Swagger middleware
  oas3Tools.initializeMiddleware(swaggerDoc, function (middleware) {
  
    // Interpret Swagger resources and attach metadata to request - must be first in swagger-tools middleware chain
    app.use(middleware.swaggerMetadata());
  
    // Validate Swagger requests
    app.use(middleware.swaggerValidator());
  
    // Route validated requests to appropriate controller
    app.use(middleware.swaggerRouter(options));
  
    // Serve the Swagger documents and Swagger UI
    app.use(middleware.swaggerUi());
  
    // Start the server
    http.createServer(app).listen(serverPort, function () {
      console.log('Your server is listening on port %d (http://localhost:%d)', serverPort, serverPort);
      console.log('Swagger-ui is available on http://localhost:%d/docs', serverPort);
    });
  
  });
  </code></pre>
  
  <p>Note: I did not modified any lines.</p>