Reputation: 1397
Lets say I have an application that might have different sections and I want to organize my controllers in the following way:
api
- controllers
- DisciplineTracker
- actionsController.js
- SomeOtherAppSection
- someOtherController.js
- models
- DisciplineTracker
- Action.js
The above is actually what the sails generator creates when entering:
sails generate controller disciplineTracker/action
In the route file how would I load up actionsController.js in the DisciplineTracker folder? Currently when I try something like:
'get /discipline-tracker/actions': {
controller: 'DisciplineTracker/ActionsController',
action: 'index'
}
I get:
error: disciplinetracker/actions.index :: Ignoring attempt to bind route (/discipline-tracker/actions) to unknown controller.action.
Any help would be appreciated. Thanks!
Edit 1: Just In Case
Yes, the index action exists inside the actionsController.js file.
Upvotes: 3
Views: 3134
Reputation: 24948
I can understand the confusion here since your sails generate controller disciplineTracker/action
seems to do something useful, when in fact it should probably just output an error because nested controllers are not supported in Sails at this time. So the short answer is, you can't do this.
Upvotes: 1