" Further, in Node.js there is a practice of creating an index.js in each
Odd you should say that because I have not come across that anywhere that I
can remember. I am currently working on contact in a node.js devops shop
(no IBMi in sight) and there are dozens of apps (all different repos) and
none have that structure. The observation that you can pretty much do what
you like is true, and if you pick a framework that has an opinion (like
Sails) on structure then it is usually fairly obvious.
One thing I will say, get used to writing your code in Typescript (not
latest language updates even if your node.js version doesn't support them
From: OpenSource [mailto:opensource-bounces@xxxxxxxxxxxx] On Behalf Of Aaron
Sent: 11 January 2018 21:37
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxx>
Subject: Re: [IBMiOSS] Node code organization
Node.js is a little odd (opinion). For example, I find that apps will
sometimes put the core of the business application in a folder named 'lib'.
In RubyOnRails I would consider the lib folder to hold Ruby extensions and
such, nothing to do with the actual business app (model, view, controller).
Further, within the lib/ folder is the domain folder (i.e. customer) and
within there is the route.js, handler.js, helper.js, model.js, etc. Again,
this is different from my RubyOnRails upbringing where, as Pete pointed out,
you'd delineate by directories first (i.e. all models go in the models/
Further, in Node.js there is a practice of creating an index.js in each
directory which, when imported, will appropriate load or do other things for
the remaining files in that directory.
On final note, this is one reason I like RubyOnRails. They picked a folder
structure that worked for 99% of web apps and sent people down that path.
IBM i hosting, starting at $157/month. litmis.com/spaces
On Thu, Jan 11, 2018 at 1:42 PM, Pete Helgren <pete@xxxxxxxxxx> wrote:
Some frameworks are opinionated and some aren't so it depends if youstructure.
are going to end up fighting conventions or not. I think just about
any framework with an MVC design pattern will group like code/objects
together and I even do that for my RPG stuff (which has no opinion).
Node itself I don't think cares about structure. It is what ever is
familiar to you, but in most cases my guess is that you'll follow
either a logical grouping of like code:
Or use a naming convention: model1.js, view1.js, controller1.js under
a single folder. My Java and Rails projects follow the convention
above; A structured, opinionated layout. My Node projects follow the
latter unless they use a framework that has it's own opinionated
I'd say with complex apps, MVC by folder groupings may be easier. For--
small apps I'd keep it simple....
GIAC Secure Software Programmer-Java
Twitter - Sys_i_Geek IBM_i_Geek
On 1/11/2018 12:20 PM, Justin Taylor wrote:
Are there standards for how Node code should be organized? I--
scaffold'd an Express app for R&D, and it gave me a dir structure.
I'm just not sure where my various bits of code should go.
This is the IBMi Open Source Roundtable (OpenSource) mailing list To
post a message email: OpenSource@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
or email: OpenSource-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
This is the IBMi Open Source Roundtable (OpenSource) mailing list To post a
message email: OpenSource@xxxxxxxxxxxx To subscribe, unsubscribe, or change
or email: OpenSource-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at https://archive.midrange.com/opensource.
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.