Feedback for a REST Framework: Automagical controller vs. generated controllers


#1

Hello Emberistas,

In the Google Summer of Code Project “TYPO3 Flow meets Ember.js” we are trying to make the PHP framework TYPO3 Flow and Ember.js (using Ember Data) work together easily through conventions and a powerful scaffolding mechanism.

We are facing a decision how we want to logically organize the server-side controllers responsible for handling the REST API requests. There are two direction:

  • Generated controllers: One controller for each model that handles the requests for the specific model.
  • Automagical controller: One controller that handles all requests for all models.

I have created a gist with a pro and cons list and the implementation differences. There is already some discussion going on from the Flow community. It would be great to have some input from the ember community as well to know how you guys would love the workflow.

Thank you, Manuel


#2

I would go with generated controllers, one controller for each model. That gives you more flexibility for power users and keep things simple in each class. For the CONS:

  1. Will lead to many files containing the very same content.
  2. Need to configure routes for every controller/model. This will result in a huge Routes.yaml file that is difficult to manage.

I think both problems could be solved by a custom resolver: http://emberjs.com/api/classes/Ember.DefaultResolver.html