mamund / Building-Hypermedia-APIs

Source code for the O'Reilly book of the same name
http://amundsen.com/hypermedia/
77 stars 37 forks source link

Ch3 Code Fails #10

Open paboulos opened 9 years ago

paboulos commented 9 years ago

Loaded and tested CouchDB with tasks worked OK. I am using Windows Powershell, localhost:3000 index page loads but no data.There is a server error when running the collection code:

PS D:\bkup\javascript\apis\Building-Hypermedia-APIs-master\nodejs\collection> node .\app.js Express server listening on port 3000 scope option is deprecated and will be removed in EJS 3 TypeError: D:\bkup\javascript\apis\Building-Hypermedia-APIs-master\nodejs\collection/views/tasks.ejs:2 1| "items" : [

2| 3| { 4| "href" : "", 5| "data" : [

Cannot read property 'length' of undefined at Object.eval (eval at (D:\bkup\javascript\apis\Building-Hypermedia-APIs-master\nodejs\collection\node_modules\ejs\lib\ejs.js:464:12), :10:22) at returnedFn (D:\bkup\javascript\apis\Building-Hypermedia-APIs-master\nodejs\collection\node_modules\ejs\lib\ejs.js:493:17) at ServerResponse.res._render (D:\bkup\javascript\apis\Building-Hypermedia-APIs-master\nodejs\collection\node_modules\express\lib\view.js:425:21) at ServerResponse.res.render (D:\bkup\javascript\apis\Building-Hypermedia-APIs-master\nodejs\collection\node_modules\express\lib\view.js:318:17) at Object.callback (D:\bkup\javascript\apis\Building-Hypermedia-APIs-master\nodejs\collection\app.js:49:9) at D:\bkup\javascript\apis\Building-Hypermedia-APIs-master\nodejs\collection\node_modules\cradle\lib\cradle\database\documents.js:45:18 at Request._onResponse as _callback at Request.self.callback (D:\bkup\javascript\apis\Building-Hypermedia-APIs-master\nodejs\collection\node_modules\cradle\node_modules\request\request.js:198:22) at Request.EventEmitter.emit (events.js:98:17) at Request. (D:\bkup\javascript\apis\Building-Hypermedia-APIs-master\nodejs\collection\node_modules\cradle\node_mod

paboulos commented 9 years ago

Updated libraries and code to latest versions. Still running into new problems, however I can get the view now by doing this: var view = 'example/due_date'; db.view(view,) method instead of db.get(view,)