I have the following code in node.js, using express:
app.post('/printUp', function(req, res) {
var multipl = new require('./multUploud').printNum(req, res);
})
and i have the following in my multUploud.js:
var partNum = 0;
module.exports = {
printNum: function (req, res){
partNum ++;
console.log(partNum);
}
}
If I sent two commands of post, I see that partNum is 1 in the first iteration, and 2 in the second.
is there any option to create a new instance for every app.post request, so it prints 1 and 1?
newdoing there?