LocalSailsApps.writeModel()

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.writeModel({

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

globalId: 'User',

code: '{}',

}).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/'
globalId required

The global ID of the model to create the file for.

'User'
code required

The model code to write.

'{}'

Exits

error

An unexpected error occurred.

success

OK.