lib/router.js
function(resName, action) {
    var route, newContent, oldFileStr, newFileStr, res;
    resName = resName || '';

    res = require('./parse_name')(resName)

    // set correct route for the required action
    // TODO Pascal case namespaces, camelcase routes
    switch (action) {
      case 'index':
        route = "  this.route('" + res.camelPlural + "',     { path: '/"+resName+"',          controller: "+res.pascalPlural+"Controller.Index });";
        break;
      case 'new':
        route = "  this.route('" + res.camelPlural + "New',  { path: '/"+resName+"/new',      controller: "+res.pascalPlural+"Controller.New });";
        break;
      case 'show':
        route = "  this.route('" + res.camelPlural + "Show', { path: '/"+resName+"/:id',      controller: "+res.pascalPlural+"Controller.Show });";
        break;
      case 'edit':
        route = "  this.route('" + res.camelPlural + "Edit', { path: '/"+resName+"/edit/:id', controller: "+res.pascalPlural+"Controller.Edit });";
        break;
      case 'comment_line':
        route = "  // " + resName + " routes";
        break;
      case 'blank_line':
        route = "";
        break;
      default:
        route = "  this.route('UNKNOWN', { path: '/', controller: UNKNOWN.index });";
        break;
    }

    // read routes.js from users folder and save to string
    // concat new route together
    oldFileStr = fs.readFileSync(this.routeDest, {encoding: 'utf-8'});
    newContent = route + "\n" + this.terminateRoute;

    // insert new content into current routes.js string
    // write new content to file `routes/controllers/resource_name.js`
    newFileStr = oldFileStr.replace(this.beforeEndOfRouter, newContent);
    fs.writeFileSync(this.routeDest, newFileStr);
  }
function(resName, action) {
    var route, newContent, oldFileStr, newFileStr, res;
    resName = resName || '';

    res = require('./parse_name')(resName)

    // set correct route for the required action
    // TODO Pascal case namespaces, camelcase routes
    switch (action) {
      case 'index':
        route = "  this.route('" + res.camelPlural + "',     { path: '/"+resName+"',          controller: "+res.pascalPlural+"Controller.Index });";
        break;
      case 'new':
        route = "  this.route('" + res.camelPlural + "New',  { path: '/"+resName+"/new',      controller: "+res.pascalPlural+"Controller.New });";
        break;
      case 'show':
        route = "  this.route('" + res.camelPlural + "Show', { path: '/"+resName+"/:id',      controller: "+res.pascalPlural+"Controller.Show });";
        break;
      case 'edit':
        route = "  this.route('" + res.camelPlural + "Edit', { path: '/"+resName+"/edit/:id', controller: "+res.pascalPlural+"Controller.Edit });";
        break;
      case 'comment_line':
        route = "  // " + resName + " routes";
        break;
      case 'blank_line':
        route = "";
        break;
      default:
        route = "  this.route('UNKNOWN', { path: '/', controller: UNKNOWN.index });";
        break;
    }

    // read routes.js from users folder and save to string
    // concat new route together
    oldFileStr = fs.readFileSync(this.routeDest, {encoding: 'utf-8'});
    newContent = route + "\n" + this.terminateRoute;

    // insert new content into current routes.js string
    // write new content to file `routes/controllers/resource_name.js`
    newFileStr = oldFileStr.replace(this.beforeEndOfRouter, newContent);
    fs.writeFileSync(this.routeDest, newFileStr);
  }
Public: Append the correct route into routes.js. The routes file is examined for the `end-routes` marker and it is removed. The new route is inserted onto the end of the file and the marker is re-appended.  resName - The {String} name of the controller action, eg index, show