Well, I ve been thinking a lot about how to structure a complex application that requires multiple conditional modules and things like that. A good idea is to use express ability to allow merge of express applications. I do not have experience with this in production, but it seems to be a good idea. You can find more info:
http://tjholowaychuk.com/post/38571504626/modular-web-applications-with-node-js-and-express In "THEORY", this could provide you many small express applications that can be easily tested individually, so, in theory, it should be great for expanding your product, or replacing configurable parts. TJ `s approach considers that all modules are inside the same node project. I am trying to work/think about the situation where I may be able to produce multiple applications (different clients, lets say) by putting together many small express applications. That way, it wouldnt make any sense to have all parts inside a unique project, but to have them as separate node_modules. The problem of this is the client-side (js/coffee/css code), the views (where they have to probably extend the same base layout). For now I am looking into https://github.com/rotundasoftware/cartero and it looks good for what I want to do (or be able to do in the future). Back to reality: in the applications that are almost in production mode, I am organizing them by making each "controller" configure its routes, by executing them as a function with the app as a parameter. I am doing that because I am not using any of these high level frameworks, just plain express. Em terça-feira, 18 de junho de 2013 04h21min20s UTC-3, Ben escreveu: > > Hey folks, > > I've searched the web pretty exhaustively, and it seems like there are > multiple best practices for factoring express routes into separate files. > I'm halfway through porting my code base over to the model described here: > http://rycole.com/2013/01/28/organizing-nodejs-express.html > > When I stumbled upon this: > > http://stackoverflow.com/questions/10306185/nodejs-best-way-to-pass-common-variables-into-separate-modules > > Since i'm using AngularJS on my client i've become familiar with the > dependency injection pattern. This second post above seems to indicate that > this is a great best practice for Node as well. > > I'm leaning towards using DI for tackling my route separation but I wanted > to check to see if there were any major reasons why this wouldnt be a good > idea? > > Thanks! > Ben > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
