​Some good commentary on how to organize larger Node projects: ​

Aaron Bartell
IBM i hosting, starting at $157/month. litmis.com/spaces

On Fri, Dec 16, 2016 at 8:50 AM, Nathan Andelin <nandelin@xxxxxxxxx> wrote:

Thanks for your response, Keven. No, my question about running one Node
instance per application (including one HTTP server instance) was not
rhetorical. Nor do I know the answer to how one might deploy hundreds of
"Node" applications, where the scope of an "application" is say 3-12
requests (i.e. insert, update, delete, read, etc.).

If you don't mind, what is your definition of "a node.js function". I
gather that you're not referring to a JavaScript function.

The following blog provides context for my question:


It describes using Node to implement an HTTP request/response event loop

1. An HTTP server listens for new requests.
2. New requests are forwarded to a "dispatcher" when they arrive.
3. The dispatcher invokes various named JavaScript functions to process
each type of request.
4. A response is generated in the function to which requests are

That blog example is somewhat simplistic in that the JavaScript functions
to which requests are dispatched to don't implement dispatch-callback logic
of their own. But it is typical of the types of node.js application samples
that one sees on the Internet.

You say that "You can plug in any number of applications...". I really
don't understand what you mean by that - other than you saying that
"applications" don't need to implement an HTTP server.


On Fri, Dec 16, 2016 at 1:35 AM, Kevin Turner <
kevin.turner@xxxxxxxxxxxxxxxxxxxx> wrote:

I guess your question is rhetorical because you probably know the answer
and yes it does kinda depend on your definition of "application". I
really like the statement "node.js has a built in http server capability"
even though I may have said it myself. This gives the noob reader the
impression that every time they write a node.js function it is "http
server" ready but of course it isn't. A node.js module is only capable of
handling http requests if it "requires" the other modules it needs and is
then coded to do so. It is only built-in because you don't have to have
previously installed any extra packages using npm. It's a bit like saying
that RPG has built in SQL capability - that doesn't mean that every RPG
program you write uses SQL.

For my sins I completely rewrote the server side element of our
Renaissance Framework in node.js and only one part of that deals with
requests from the client. You can plug in any number of applications and
all they deal with is the handling of inbound and outbound data in JSON
format. When a programmer develops a CRUD application/function for the
customer master file, they only care about two things - the receipt and
handling of the inbound JSON data and the creation and return of the
outbound JSON data. The fact that this eventually gets delivered to an
client is of zero consequence. These functions/applications have no http
server capability at all.

Sent from my iPad

This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.