LocalSailsApps.buildRoutesConfig()

Generate a JavaScript code string for the `config/routes.js` file (i.e. in a Sails.js app.)

Usage

Hover over inputs/exits for more info.

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


// Generate a JavaScript code string for the `config/routes.js` file (i.e. in a Sails.js app.)

LocalSailsApps.buildRoutesConfig({

targets: [ { controller: 'Slug$Controller', action: 'find_ducks', method: 'GET', path: '/:user/ducks' } ],

}).execSync();

Inputs

targets required

An array of configured route targets (i.e. including controller and action)

[ { controller: 'Slug$Controller',
    action: 'find_ducks',
    method: 'GET',
    path: '/:user/ducks' } ]

Exits

error

An unexpected error occurred.

N/A

success

OK.

'module.exports = {\\n  "GET /:user/ducks": "Slug$Controller.find_ducks"\\n};\\n'