title: swagger-ui-express is not rendering in browser but has response body in Postma
body: <p>I am trying to document an API, for which i use <code>swagger-ui-express</code>. 
  When I use the following, </p>
  
  <pre><code>app.use('/api-docs/*', swaggerUi.serve, swaggerUi.setUp(swaggerDoc)
  </code></pre>
  
  <p>or</p>
  
  <pre><code> app.use('/api-docs/*', swaggerUi.serve)
   app.get('/api-docs/*', swaggerUi.setup(swaggerDoc))
  </code></pre>
  
  <p>Everything works perfect, But I want the <code>swaggerDoc</code> to get created dynamically based on the URL hit, hence I add the following code. But now, the HTML page never renders in the browser but when hit in Postman, it seems to have the same response body as when the HTML rendered for the previous method.</p>
  
  <p>So when I modify the above code as below,</p>
  
  <pre><code>    app.use('/api-docs/*', swaggerUi.serve)
      app.get('/api-docs/*', function(request, response, next){
          console.log(request.url);
          var apiNameSplitArray = request.url.split('/')
          var apiName = apiNameSplitArray[2]
          swaggerDoc = JSONConstructor.JSONConstructorTest(apiName.trim())
          next()
      })
      app.get('/api-docs/*', swaggerUi.setup(swaggerDoc))
  </code></pre>
  
  <p>It does not work(does not get rendered in the browser). When I checked the control flow using breakpoints, I noticed the following method execution order</p>
  
  <ol>
  <li><code>app.use</code></li>
  <li>2nd <code>app.get</code></li>
  <li>1st <code>app.get</code></li>
  </ol>