Hacker News new | ask | show | jobs
by mischov 2267 days ago
Can you expand on what you mean by "it's 'opinionated' macro based module generation is a hindrance to building a more typical api based http service"?
1 comments

sure. what i mean is by opting in to `use Phoenix.Controller` you are also opting into `MyApp.PageController`, `MyApp.Endpoint`, `MyApp.PageView`, `MyApp.ErrorView`, `MyApp.LayoutView`... which are all modules you include via macros in your actual implementation (or which are included by other includes)

all of these modules assume a traditional server rendered html environment with appropriate CORS, session handling, form security, etc none of which are particularly relevant to returning json from an api request

it is possible to opt out and directly manipulate the Plug conn (and set the response) but at that point Phoenix is bringing almost nothing to the table