title: Koa : what is the difference between koa-route and koa-mount. When should I use each?
body: <p>I am trying to use Koa.js, and checked out the following modules for routing requests:
  1. koa-route
  2. koa-mount</p>
  
  <p>When I check their github page/tutorials in google, the examples look almost similar with minor differences.</p>
  
  <ol>
  <li><p>For koa-route:</p>
  
  <pre><code>var route = require('koa-route');
  app.use(route.get('/', index));
  
  //functions to handle the request
  function* index(){
      this.body = "this should be home page!";
  }
  </code></pre></li>
  <li><p>For koa-mount:</p>
  
  <pre><code> //syntax to add the route
  var mount = require('koa-mount');
  var a = koa();
  app.use(mount('/hello', a));
  
  //functions to handle the request
  a.use(function *(next){
    yield next;
    this.body = 'Hello';
  });
  </code></pre></li>
  </ol>
  
  <p>The only difference seems to me is mount needs a middleware to serve the request, while route needs a generator to serve the requests.</p>
  
  <p>I am confused when to use what and when to use both(saw that in some tutorials)?</p>