I am trying to use connect-flash with sails.js, according to middleware documentation of sailsjs http://sailsjs.org/documentation/concepts/middleware , this is what I did
passportInit : require('passport').initialize(),
passportSession : require('passport').session(),
flash : require('connect-flash'),
order: [
'startRequestTimer',
'cookieParser',
'session',
'passportInit',
'passportSession',
'flash',
'myRequestLogger',
'bodyParser',
'handleBodyParserError',
'compress',
'methodOverride',
'poweredBy',
'$custom',
'router',
'www',
'favicon',
'404',
'500'
]
and this is how my AuthController.js looks ( as I am using connect-flash with passport )
module.exports = {
_config: {
actions: false,
shortcuts: false,
rest: false
},
'login': function(req, res,next) {
passport.authenticate('local', { successRedirect: '/user/dashboard',
failureRedirect: '/login',
failureFlash: true })(res,req,next);
},
'logout': function(req, res) {
req.logout();
res.redirect('/');
}
};
But after adding flash in the queue pages never finish loading and it never renders. Please can anybody assist me with this? I am not sure how to make this work. Thanks in advance.