Re: [Windows Azure] Node.js Quiz 1

Wednesday, December 21, 2011

 

when continuously press the reload button then the result will: 
Express Data: 0 and 0
Express Data: 1 and 2
Express Data: 3 and 4
Express Data: 5 and 6
Express Data: 7 and 8
Express Data: 9 and 10 and so on. 

--- On Tue, 12/20/11, Zia Khan <ziaukhan@hotmail.com> wrote:

From: Zia Khan <ziaukhan@hotmail.com>
Subject: [Windows Azure] Node.js Quiz 1 [1 Attachment]
To: "Zia Khan" <ziakhan@gmail.com>
Date: Tuesday, December 20, 2011, 2:02 PM

 

We have two Node.js modules:
 
//program.js
var app = require('express').createServer();
var math = require('./math');
var math2 = require('./math');
app.get('/', function(req, res) {
res.send('Express Hello, world!');
});
var data = 0;
var data2 = 0;
app.get('/data', function(req, res) {
 
data = math.add();
if(data != 0) {
    data2 = math2.add();
}
 
res.send('Express Data: ' + data + ' and ' + data2);
});
app.listen(3000);
 
 
//math.js
var v = 0;
 
function add() {
    return v++;
}
 
exports.add = add;
 
What will be the outputs in the browser if you continuously press the reload button?
 
The complete code is attached so that you can run the program.
 
 

__._,_.___
Recent Activity:
Cloud Computing Education: http://www.OperationBadar.net
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

0 comments:

Post a Comment