Hacker News new | ask | show | jobs
by ethnt 1661 days ago
Depending on your architecture, an API or rendering HTML is an implementation detail, rather than the meat of the application. Have your business logic elsewhere and have the API or controller endpoints call out to those and just do the business of rendering JSON or HTML in the controllers.

(I think this is inversion of control, someone can correct me if I'm wrong)