Code Monkey home page Code Monkey logo

building-hypermedia-apis's Introduction

building-hypermedia-apis's People

Contributors

mamund avatar risseraka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

building-hypermedia-apis's Issues

There are no links to create a user from the user or users page

There are not references to the register page from the user.ejs or the users.ejs files. Shouldn't there be a link or something so consumers would know how to create new users?

In the json example, this was included on the collection resource. Would it be the same here?

This should be linked from amundsen.com/hypermedia/

P. 43 (among many others) of Building Hypermedia APIs with HTML5 and Node points to an appendix page saying that the source for the apps in the book can be found at amundsen.com. Unfortunately, there's no link from that page to this repo, or to a zip file, or anything else useful. It's only due to some digging and guessing about GitHub that I found this repo in the first place.

Your book is good! It's way more useful with the source available!

Ch3 Code Fails

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

NodeJs Collection code JSON response error

A GET request to the express URL http://localhost:3000/collection/tasks/ receives a SyntaxError: JSON.parse: unexpected non-whitespace in the application/json response body.

"items" : [

  {
    "href" : "http://localhost:3000/collection/tasks/task3",
    "data" : [
      {"name" : "description", "value" : "This is my third task.", "prompt" : "Description"},
      {"name" : "completed", "value" : false, "prompt" : "Completed"},
      {"name" : "dateDue", "value" : "2011-11-30", "prompt" : "Date Due"}      
    ]
  }
  ,

  {
    "href" : "http://localhost:3000/collection/tasks/task2",
    "data" : [
      {"name" : "description", "value" : "This is my second task.", "prompt" : "Description"},
      {"name" : "completed", "value" : true, "prompt" : "Completed"},
      {"name" : "dateDue", "value" : "2011-12-29", "prompt" : "Date Due"}      
    ]
  }
  ,

  {
    "href" : "http://localhost:3000/collection/tasks/task1",
    "data" : [
      {"name" : "description", "value" : "This is my first task.", "prompt" : "Description"},
      {"name" : "completed", "value" : false, "prompt" : "Completed"},
      {"name" : "dateDue", "value" : "2011-12-31", "prompt" : "Date Due"}      
    ]
  }


]

Cannot read property 'cells' of undefined

Hi Mike,

I have gone back and read your Hypermedia book (and two other newer ones). I am appreciative of your work. Thank you.

FYI, I have tried to run your code here and run into error. Not sure if it is node/npm/ejs version issue or something else...just letting you know. I realize this is old code but passing along the information anyways.

~/projects/Building-Hypermedia-APIs/nodejs/maze$ node app.js Express server listening on port 3000 scope` option is deprecated and will be removed in EJS 3
/home/rafs/projects/Building-Hypermedia-APIs/nodejs/maze/app.js:90
tot = Object.keys(doc.cells).length;
^

TypeError: Cannot read property 'cells' of undefined
at Vargs.callback (/home/rafs/projects/Building-Hypermedia-APIs/nodejs/maze/app.js:90:26)
at /home/rafs/projects/Building-Hypermedia-APIs/nodejs/maze/node_modules/cradle/lib/cradle/database/documents.js:45:18
at Request._onResponse [as _callback] (/home/rafs/projects/Building-Hypermedia-APIs/nodejs/maze/node_modules/cradle/lib/cradle.js:215:20)
at self.callback (/home/rafs/projects/Building-Hypermedia-APIs/nodejs/maze/node_modules/request/request.js:185:22)
at emitOne (events.js:115:13)
at Request.emit (events.js:210:7)
at Request.onRequestError (/home/rafs/projects/Building-Hypermedia-APIs/nodejs/maze/node_modules/request/request.js:877:8)
at emitOne (events.js:115:13)
at ClientRequest.emit (events.js:210:7)
at Socket.socketErrorListener (_http_client.js:401:9)
`

Regards,
Rafs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.