Vra

Most express middleware look like this:

var foo = function( req, res, next ) {

}

Is there anyway to REMOVE properties from the req object such that it will reflected in the next handler in the stack?

Was dit nuttig?

Oplossing

Just delete it.

For example:

function logout (req, res, next){
    delete req.session['user'];
    res.redirect(302,'/');
};

Obviously if you are deleting things subsequent middleware expects to be present you may have issues.

You can read the doc on delete here.

Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow
scroll top