Merge / split controller for UI and API?
Matt Wagner
matt.wagner at redhat.com
Mon Mar 26 17:10:38 UTC 2012
On Mon, Mar 26, 2012 at 04:54:41PM +0200, Petr Blaho wrote:
> Hi all,
>
> I am now working on preparing API for Provider and ProviderAccount resources
> so I want to ask some questions regarding controllers for API.
>
> At this moment there are some controllers in API namespace and so there is duplicated functionality between UI and API parts.
>
> In the future we will be adding features to API and CLI tool too.
>
> I think that we need to decide wheter keep UI and API controllers separated or merge them together.
>
> I think that best will be to merge them together.
> Controller should be as skinny as possible with minimum logic (parameters sanitizing, model call, render results - view or whatever).
> Controller should respond to html, js, json, xml, etc...
> All the logic now present in controllers should be moved to models or some other classes which will work with models (delegators, decorators, name it...)
>
> Please, write your thoughts and/or experience with this kind of problem.
I agree 100%. We should not have a separate api/ directory of
controllers, especially not when they end up implementing similar
functionality.
I do think we need to be careful about the fact that existing
applications might reference the /api URLs, though.
-- Matt
More information about the aeolus-devel
mailing list