Session.save()

Save a string value to the current session under the specified key.

Note that the data will not actually be persisted to the session until the response is sent. This is due to how the session middleware works in Connect/Express/Sails.

Usage

Hover over inputs/exits for more info.

var Session = require('machinepack-session');


// Save a string value to the current session under the specified key.

Session.save({

key: 'loggedInAs',

value: 'some string',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function () {

 

},

});

Inputs

key required

The name of the key in the session store.

'loggedInAs'
value required

The data to save to the current session.

'some string'

Exits

error

An unexpected error occurred.

success

OK.