Nathan,

So that "routing" becomes more of a matter of retrieving some metadata
from a table keyed by "application_id"?

All we have at this point is a vague definition of 500 "applications" that
each have 15 "requests". I have no way to begin to recommend strategies
without gaining a whole lot more knowledge about the app. Putting it in
the DB could be the best thing ever (i.e. dynamic routing), or it could
slow the app down. Hard to say.


Aaron Bartell
litmis.com - Open Source and IBM i. No Limits.


On Wed, Sep 2, 2015 at 1:09 PM, Nathan Andelin <nandelin@xxxxxxxxx> wrote:

Aaron,

Thanks for the link. It still seems to me the the noun "app" is something
of a misnomer for the value returned by express(). I've considered a couple
alternatives:

router = express();

Request "routing" is a primary function of Express.JS. But it also includes
additional middleware, so perhaps a non-descriptive word may be more
appropriate, such as:

express = express().

I saw from the link you posted various ways to modularize "routing" code.
But it all seems to boil down to calling a function:

express.get("/path/...", callback(request, response) {...});

Given my previous scenario of deploying say 500 "applications" with each
scoped to handle 15 "requests" on average, it may take up to 1,500 calls
to:

express.get()

with each call comparing the URL "path" from a list of alternatives, in
order to resolve the "route" to the appropriate handler. That seems like a
lot of function calls and string comparisons.

I'm thinking of an alternative. Say a URL includes both an "application"
and a requested "action", say:

http://example.com/application_id/action_id

Where "application_id" points to a reference in a database table. So that
"routing" becomes more of a matter of retrieving some metadata from a table
keyed by "application_id"?







On Wed, Sep 2, 2015 at 7:38 AM, Aaron Bartell <aaronbartell@xxxxxxxxx>
wrote:

Using Express.JS, would you deploy 500+ HTTP server instances?

You could, or you could create a /routes folder in your application
structure and create a separate file for each "application".

Further info: http://bit.ly/1Na87Ev

Aaron Bartell
litmis.com - Open Source and IBM i. No Limits.


On Wed, Sep 2, 2015 at 8:35 AM, Nathan Andelin <nandelin@xxxxxxxxx>
wrote:

The basis of my question is the "Hello World" example at:

http://expressjs.com/starter/hello-world.html

It's just 10 lines of code. One of the relevant statements is:

var app = express();


Which is followed by:

var server = app.listen(3000, function () {


The app.listen() method appears to be instantiating an HTTP services.
Is
that to say that each express.js application includes its own HTTP
service?

Personally, I tend to scope Web "applications" to handle perhaps 10-15
distinct types of requests. An application for querying and maintaining
Purchase Orders would be distinct from one which queries and maintains
Work
Requests, for example. That keeps the code modular.

We have deployed 500+ "applications" of that type of scope.

Using Express.JS, would you deploy 500+ HTTP server instances?
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing
list
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.


--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
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.


--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
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 ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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.