title: Route.get() requires callback function but got a [object Promise]
body: <p>I am creating a REST API with express, folowing the architecture from <a href="https://medium.com/netscape/mean-app-tutorial-with-angular-4-part-1-18691663ea96" rel="nofollow noreferrer">this article</a>.
  in a nutshell, a router is calling a controller.</p>
  
  <p>here is an example of a call:</p>
  
  <pre><code>router.get('/', ModelsController.getModels)
  </code></pre>
  
  <p>This work fine so far, and now, I'm improving error handling with Boom.</p>
  
  <p>I would like to use the wrapper like in <a href="https://michalzalecki.com/an-elegant-solution-for-handling-errors-in-express/" rel="nofollow noreferrer">this article</a>, but as I don't use TS and as I am unfamiliar with Promises, I'm struggling with it.</p>
  
  <p>Here is the wrapper:</p>
  
  <pre><code>exports.enhanceHandler = async function (handler) {
      return async function (req, res, next) {
  
          try {
              const result = await handler(req, res);
              if (result instanceof Error &amp;&amp; Boom.isBoom(result)) {
                  res.status(result.output.statusCode).send(formatBoomPayload(result));
              }
          } catch (error) {
              // now log errors to your errors reporting software
              if (process.env.NODE_ENV !== "production" &amp;&amp; (error.stack || error.message)) {
                  res.status(500).send(error.stack || error.message);
              } else {
                  res.status(500).send(Boom.internal().output.payload);
              }
          }
  
          next();
      }
  }
  </code></pre>
  
  <p>I'm trying to call it in my router, like this:</p>
  
  <pre><code>router.get('/handler', enhanceHandler(ModelsController.getModels))
  </code></pre>
  
  <p>However, I've got this error:</p>
  
  <pre><code>Error: Route.get() requires a callback function but got a [object Promise]
  </code></pre>
  
  <p>What could I do ? Do I need to resolve the promise ? modify enhanceHandler so it return a function and not a promise ? </p>