@jake - thanks for the MVC overview.

My question was specific to node.js - for, let's say, an express.js
application. are there best practices for layout of directory structure?
recommended component patterns? what do you export from a class? where do
you put custom middleware? how about parameter processors? things like
that. While I get the MVC nature of express, the fact that there isn't much
in terms of best practices in this area makes this a question that needs
some attention.

Thanks,

Anatoly

On Thu, Nov 10, 2011 at 6:06 PM, Jake Verbaten <[email protected]> wrote:

> Generally applications have 4 parts to them
>
>  - Routers. You take a reference to you router and register URI fragments
> to callbacks. These callbacks talk to your domain objects or data layer and
> then pipe them through your views
>  - Domain objects. These represent the REST resources you have. Generally
> they have constructors from user input that do aggressive validation. They
> also talk to your data layer.
>  - Data layer. Simple wrapper around your database, these methods talk
> directly to your database or any other data source you have
>  - Views. Any Domain object -> HTML/JSON/XML/etc conversion system you
> want.
>
> [Image](
> https://docs.google.com/drawings/d/1_uUvXjop0PazdhnVkiF3Do5UTCiN1I-Nt3oMylGwgyc/edit
> )
>
> basically you have bidirectional communications. The router is a central
> middleman that asks every other module to do a task for it. It's a very
> simple modular architecture. You also deal with websockets by having the
> domain objects emitting change events and the domain objects can emit
> change events either manually or by listening on database push events.
>
> If you want to 1up it have every thing live in it's own hook (hook.io)
> and then use cross process communication between them.
>
>
> On Fri, Nov 11, 2011 at 12:39 AM, Anatoly Geyfman <[email protected]>wrote:
>
>> Codeigniter related items aside (which are irrelevant and
>> counter-productive), the question is a very good one, and not very much
>> addressed on the webs. How do you guys structure your node.js apps?
>>
>> Thanks,
>> Anatoly
>>
>>
>> On Thu, Nov 10, 2011 at 4:27 PM, Timothy J. Warren 
>> <[email protected]>wrote:
>>
>>> Mediocre in what way? That it doesn't have arbitrarily forced paradigms
>>> of other frameworks? It's not like I put all of my logic into controllers.
>>>
>>> The point is flexibility and simplicity. I'll look into those libraries
>>> to see how they handle it.
>>>
>>>
>>>
>>>  --
>>> To view archived discussions from the original JSMentors Mailman list:
>>> http://www.mail-archive.com/[email protected]/
>>>
>>> To search via a non-Google archive, visit here:
>>> http://www.mail-archive.com/[email protected]/
>>>
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>>
>>
>>  --
>> To view archived discussions from the original JSMentors Mailman list:
>> http://www.mail-archive.com/[email protected]/
>>
>> To search via a non-Google archive, visit here:
>> http://www.mail-archive.com/[email protected]/
>>
>> To unsubscribe from this group, send email to
>> [email protected]
>>
>
>  --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/[email protected]/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to