I have a fairly complicated controller and thought I’d post how I’m
structuring it in case anyone else has a better idea. It’s going to
be open source, so eventually people will be able to comment on the
design anyways.
The controller is an entry point for a service that provides a unified
api to a number of different backend services. The controller has
very little code, and I’ve put most of the code in modules under
rails_root/lib. Is there a reason to not do it this way? One reason
I structured it this way is so the api could be used directly. You
can run rails and offer it as an api via http post, or just use the
api directly from your code.