rethinkdb-example-nodejs
rethinkdb-example-nodejs copied to clipboard
getting parse error
function* create(next) {
try{
// Parse the POST data
var todo = yield parse(this); //this throws an error
https://github.com/rethinkdb/rethinkdb-example-nodejs/blob/master/todo-angular-koa/app.js#L64 This example throws an error for me.

I tried yield parse.json(this) and still not sure what the deal is. Same message.
Typically this means its not an object...but a string, and it indeed looks like JSON.stringify was ran on it.
Hi @chovy. It looks like it's trying to parse a javascript object literal as json, and failing because the key isn't double quoted. I'll have to dig into this repo to fix it, which may take a while to get to.
In the meantime, if you happen to find the root cause and hack around it, I'd welcome any pull requests.
I'll see if I can find the root cause in the meantime.
Looks like co-body is for co not koa.
Reccommended use is to use koa-bodyparser: https://github.com/koajs/bodyparser
I will see if I can get it working tonight and let you know.