title: In Koa, what's the difference between await next(), return await next(), return next(), and next() in middleware?
body: <p>The documentation outlines the use-case for using 'await next()' in middleware, causing the middleware to pause and trigger the next middleware downstream until all middlewares are done executing at which point the upstream cascade will begin and the middlewares will complete execution. And if a user wants to cut the cascade short then writing 'return' alone will cut the cascade all together.</p>
  
  <p>What I don't understand is what happens if the user returns one of the following:</p>
  
  <pre><code>const exampleMiddleware1 = async (ctx, next) =&gt; {
    return await next();
  
    console.log('Doing something');
  };
  
  const exampleMiddleware2 = async (ctx, next) =&gt; {
    next();
  
    console.log('Doing something');
  };
  
  const exampleMiddleware3 = async (ctx, next) =&gt; {
    return next();
  
    console.log('Doing something');
  };
  </code></pre>
  
  <p>In the first example, I think it will pause, trigger the next middleware, but will not finish the execution on the upward cascade.</p>
  
  <p>In the second example, I think the next middleware will be triggered along with the console.log, I don't think it will trigger on the upward, maybe?</p>
  
  <p>In the third example, I think the next middleware will be triggered but it will not trigger the console log on the upward cascade, the same as the first example.</p>
  
  <p>Is my thinking correct? I'm writing a koa app and would like to learn more about its limits and I find this one area I don't understand clearly.</p>