LocalSailsApps.writeController()

Write a controller file to an app api/controllers folder

Usage

Hover over inputs/exits for more info.

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


// Write a controller file to an app api/controllers folder

LocalSailsApps.writeController({

destination: '/Users/mikermcneil/foo/',

controllerName: 'HomeController',

code: 'module.exports = {}',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function () {

 

},

});

Inputs

destination required

The path to the app (if path is not absolute, will be resolved from the current working directory)

'/Users/mikermcneil/foo/'
controllerName required

The name of the controller file to create.

'HomeController'
code required

The controller code to write.

'module.exports = {}'

Exits

error

An unexpected error occurred.

success

OK.