node-for-frontend-devs icon indicating copy to clipboard operation
node-for-frontend-devs copied to clipboard

connect.router error

Open seb-thomas opened this issue 12 years ago • 2 comments

Hi, I just bought your book, but I'm having some trouble working through a number of the stages because of a problem with connect.router. It seems that this router method was removed from connect some time ago. http://stackoverflow.com/questions/10266168/node-js-connent-modul-error-information

Simply npm installing express doesn't magically fix the issue, I was hoping you might have some pointers on getting these examples updated.

They seem to be used frequently in the rest of the book, and I'd really like to finish this templating section.

Thanks

seb-thomas avatar Aug 13 '12 16:08 seb-thomas

I am also now hitting that same issue working through the examples. After finding a blog that shows how to work around this:

http://blog.riff.org/2012_04_09_missing_the_connect_router_middleware_for_nodejs

And another stack overflow article on how to use some other approach (the chosen answer) or simply use express which does have router:

http://stackoverflow.com/questions/9571239/mac-os-x-nodejs-has-no-method-router-error

I am thinking the work around is messy and get's you working sooner... but I am not liking it. The stack overflow article shows using the "use" function or.... express. But I think that defeats the books intention of showing bare bones vs. framework.

InvisibleTech avatar Sep 01 '12 04:09 InvisibleTech

Well, moved to using the new approach and I a think I am now hitting the fact that url placeholders (i.e. :firstName) are not part of connect. Moving on... hope to not hit more such issues in the book.

InvisibleTech avatar Sep 01 '12 04:09 InvisibleTech