Executing functions in series
- by Latanmos
Hi,
First of all... Happy new year!
Could you please explain to me, how does this work? I browsed throught Connect's (https://github.com/senchalabs/connect) source code, but I don't get it.
I would like to write it by myself.
app.get(
'/',
function(req, res, next) {
// Set variable
req.var = 'Happy new year!';
// Go to next function
next();
},
function(req, res, next) {
// Returns 'Happy new year!'
console.log(req.var); // <- HOW IS THIS POSSIBLE?
// (...)
}
);
Thanks in advance!