LocalSailsApps.deduceControllers()

Determine the conventional controller+action to use for the given set of routes.

Usage

Hover over inputs/exits for more info.

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


// Determine the conventional controller+action to use for the given set of routes.

LocalSailsApps.deduceControllers({

routes: [ { method: 'GET', path: '/:user/ducks', responses: {}, files: [ 'avatar' ], machine: {} } ],

}).execSync();

Inputs

routes required

An array of route definitions (HTTP method + URL path)

[ { method: 'GET',
    path: '/:user/ducks',
    responses: {},
    files: [ 'avatar' ],
    machine: {} } ]

Exits

error

An unexpected error occurred.

N/A

success

OK.

[ { controller: 'Slug$Controller',
    actions: 
     [ { controller: 'Slug$Controller',
         action: 'find_ducks',
         method: 'GET',
         path: '/:user/ducks',
         responses: {},
         files: [ 'avatar' ],
         machine: {} } ] } ]