title: Setup of swagger-ui-express with API Gateway
body: <p>I am not able to figure out the correct setup of either my API Gateway or swagger-ui-express.
  The lambda function runs successful and and return the html but the related resouces are not able to be loaded and get an 404 error.</p>
  <pre><code>const app = express();
  const swaggerUI = require('swagger-ui-express');
  const serverlessExpress = require('@vendia/serverless-express');
  
  const Stage = process.env.Stage;
  const apiId = process.env.apiId;
  const options = {
      customCss: '.swagger-ui .topbar { display: none }',
      customCss: '.swagger-ui .topbar { background-color: red }'
  }
  
  let serverlessExpressInstance
  
  async function asyncTask() {
      // load latest spec from API Gateway export removed to simplicity reasons.
      const swaggerDocument = spec;
      console.log(&quot;load swagger file complete.&quot;);
      return swaggerDocument
  }
  
  async function setup(event, context) {
      const swaggerDocument = await asyncTask()
      console.log(swaggerDocument)
  
      app.use('/api-doc', swaggerUI.serveWithOptions({ redirect: false }));
      app.use('/api-doc', swaggerUI.setup(swaggerDocument, options));
      console.log(&quot;setup of swagger complete&quot;);
  
      serverlessExpressInstance = serverlessExpress({ app })
      return serverlessExpressInstance(event, context)
  }
  
  function handler(event, context) {
      if (serverlessExpressInstance) return serverlessExpressInstance(event, context)
      return setup(event, context)
  }
  
  exports.handler = handler
  </code></pre>
  <p>Setup on API Gateway is the following:</p>
  <p><a href="https://i.stack.imgur.com/DjZ4p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DjZ4p.png" alt="API Gateway resources" /></a></p>
  <p>Both resources are pointing to the lambda function.
  When I load the page via: https://.execute-api..amazonaws.com/dev/api-doc
  The following errors are raised:</p>
  <p><a href="https://i.stack.imgur.com/ROB2I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ROB2I.png" alt="Error logs" /></a></p>
  <p>How can I ensure that the resources are loaded correctly via the correct path ...dev/api/doc/...</p>