import {Router} from '../../../src/koapi';
import Post from '../models/post';

const posts = new Router();

  posts.get('/posts', function*(){
    try {
      a;
      this.body = yield Post.fetchAll();
    } catch (e) {
      // console.log(e);
      // this.body = e.message;
      this.throw(e, 500);
    }
  });

  posts.get('/posts/:id', function*(){
    var post = yield Post.where({id: this.params.id}).fetch({'withRelated':'comments'});
    this.body = post;
  });

  posts.post('/posts', function *() {
    var post = yield new Post(this.request.body).save();
    this.body = post;
  });

export default posts;

@@ -140,29 +140,8 @@
 ()%7B%0A
-    try %7B%0A      a;%0A  
     
@@ -179,115 +179,8 @@
 ();%0A
-    %7D catch (e) %7B%0A      // console.log(e);%0A      // this.body = e.message;%0A      this.throw(e, 500);%0A    %7D%0A
   %7D)

. typo