pcimino / nodejs-restify-mongodb

Demonstration CRUD REST services
Apache License 2.0
77 stars 25 forks source link

Nodejs Meetup Feed Back #12

Open pcimino opened 10 years ago

pcimino commented 10 years ago

Had a code roast, here are some of the suggetions I want to work on next....

pcimino commented 10 years ago

Tackled the last bullet today. Most of the modules (config, auth) can now be pulled in using require instead of passed as method args.

pcimino commented 10 years ago

Last night I looked at modularizing the methods. The comment was: Avoid passing the request/response objects all the way down the chain.

The problem I'm having is each call is a nested chain of callbacks and promises. So breaking out the functionality into methods doesn't work since almost everything is asynchronous. Putting them in promise chains will create many extra methods, And I still have to pass around the response object. So not sure how to tackle this yet.

pcimino commented 10 years ago

Cleaned up the get() to use the stream pipe instead of multiple code blocks.