Hi all,

I'm new here and want to make a simple test web app with NodeJS and Express
framework.

I created  2 request are http://localhost:3000/heavycompute (very long time
processing) and http://localhost:3000/
<http://localhost:3000/heavycompute> (just
display text, return immediately) and handling methods for them as below
code:

*module.exports = function(app) {*
*//for * http://localhost:3000/ <http://localhost:3000/heavycompute>
*  app.get('/', function(req, res){*
*      res.render('index', { title: 'Express', html: 'html param' });*
* **  } );*
*
*
*
*
*//for * http://localhost:3000/ <http://localhost:3000/heavycompute>
heavycompute
*   app.get('/heavycompute', function(req, res) {*
*        var sum = 0;*
*        for(var i = 0; i < 99998888777; i++) {*
*            sum += i;*
*        }*
*        res.render('index', { title: 'Express', html: sum });*
*    } );*
*};*
*
*
The problem here is when I open simultaneously 2 tabs, each method on a
tab, enter http://localhost:3000/heavycompute *FIRST*, then hit
http://localhost:3000/ <http://localhost:3000/heavycompute>,

I expect http://localhost:3000/ <http://localhost:3000/heavycompute> return
right away, but seem it must wait for completion of
http://localhost:3000/heavycompute request handler.

Could you help me pointing out what I have done wrong here with my code?
I'm new and not sure I handle event-driven mechanism in coding properly, I
want each handler should process each request separately as normal threaded
web app server (tomcat, IIS,...).

Appreciate any explanation/help.

Thanks in advance.
-- 
Nguyen Hai Duy
Mobile : 0914 72 1900
Yahoo: nguyenhd_lucky

-- 
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to