javascript - Calling super method in sails.js controller -


when create controller in sails.js standard method redefined, how call default parent method of controller?

module.exports = {     create: function(req, res) {         //test parameters            if (condition) {             //call regular super method, proceed usual             //_super(); <- how this?         } else {             //do other things         }     } }; 

update: sails >= v0.10.x, see the comment below @naor-biton

if want access default implementation (the blueprint), of v0.9.3, can call next() (the third argument controller). because sails based on express/connect concept of middleware, allowing chain things together.

please note behavior may change in subsequent version, since next() how call default 404 handler (config/404.js) actions don't have blueprint underneath them.

a better approach, if you're interested in using blueprints running bit of logic beforehand, leave controller action undefined , use 1 or more policies, run beforehand.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -