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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -