LocalSailsApps.buildController()

Build a JavaScript code string for a Sails.js controller using the provided metadata.

Usage

Hover over inputs/exits for more info.

var LocalSailsApps = require('machinepack-local-sails-apps');


// Build a JavaScript code string for a Sails.js controller using the provided metadata.

LocalSailsApps.buildController({

actionTargets: [ { action: 'find_ducks', responses: {}, files: [ 'avatar' ], machine: {} } ],

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

actionTargets required

An array of action target definitions (action + machine identity + responses)

[ { action: 'find_ducks',
    responses: {},
    files: [ 'avatar' ],
    machine: {} } ]

Exits

error

An unexpected error occurred.

N/A

success

OK.

'module.exports = {\\n  "find_ducks": function(req,res) { ... }\\n};\\n'