Hacker News new | ask | show | jobs
by mparke 5517 days ago
my first suggestion is then to break your server up into more modules, which should improve your situation. I'm fairly new to node, but currently building a few different apps. I'd recommend reading nodebeginner.org , you can also check out a Node Server git repo i just created tonight, implemented based on that tutorial. https://github.com/mparke/Node-Server-Exploration Feel free to contact me if you want to chat more. I'd love to hear about your experiences with Node.
2 comments

This definitely feels like something that will help a lot. I tend to be doing similar things in many places of my code, like getting the current user's document from the user DB, and handling errors in the same way(by passing {error: "description"} and a status code of 500 back to the client). By factoring out shared/similar code into a library, I think the code will get a lot cleaner. Thanks for the suggestion!
This is really nice, thanks mparke!