em-wilson / book-node-mongodb-backbone

Example source code accompanying O'Reilly's "Building Node Applications with MongoDB and Backbone" by Mike Wilson

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A couple of questions: running code at end of chap 5; improving form in chap 6

bethrobson opened this issue · comments

First, is there a way to run the code at the end of chapter 5? I am guessing not, but just curious. I tried loading various files, but nothing seemed to work except just localhost:8080/ which loaded the index view (node).

Second, in Chap 6 / Registration, you suggest that we could improve the form to test the password, and also give messages to the user if the login failed. I'm looking at the code and don't really know how to do either of those things. I'm guessing I could check the confirm email and confirm password in the register function itself. But to provide messages back to the user in case of a failure: that I have no idea. Okay, maybe one idea: perhaps have another element (or create one on the fly), "#error", that is rendered in case of a failure. BUT, how do you render one element (the "#content" element) on success, and a different element ("#error") on failure? Perhaps having an alternate template? And in app.js, the 200 code is sent back, so how do we get the error information back to to the user?

Anyway, my point is that it would be awesome to include more details about these suggestions, perhaps as part of the code download or a supplement to the book, or an appendix, or...

So far I'm up through Registration in chapter 6. One thing that I occasionally find challenging is figuring out exactly where a file should go and what it should be named. Sometimes it's clear, other times, not. It would be great to go back and make sure that each and every code example has a full path to the file name in the caption.

Thanks for the comments. The code at the end of Chapter 5 runs; since this chapter is about setting up the project, the runnable code doesn't do much. http://localhost:8080 will bring up a glorified 'Hello, World' type of page. Since each chapter builds off the code from the one before, Chapter 5 is the framework the rest of the book builds upon.

For Registration/flash messages, the pacing of the book is too quick and definitely passes over some of those nice extras. This would make a great blog post, and might find its way into the 2nd edition. I was worried that if I included it the chapter would meander too far and be even harder to follow.

Common complaint with the book is not being sure where bits of code should go. I tried to head that off with the 'putting it all together' sections, but there has still been a lot of confusion. The idea is for each chapter to produce a usable, working app without needing to use the example code, but in practice a lot of people are having trouble plugging the parts together.

Thanks for the detailed feedback; this is really helpful.