`Phoenix.View` deprecation and multi-format endpoints

I have looked into Phoenix.View deprecation and one thing seems worrying to me. The “new” approach with Phoenix.Component and “view functions” is lacking one important feature that I was using pretty extensively in my project - multi format output.

My project is meant to be similar to Lobste.rs page where I want to accommodate a lot of “features” from long forgotten Web 2.0, for example Microformats. The thing is that there I do not separate “API endpoints” form “HTML endpoints” and each endpoint can return data using different encoding formats depending on what user wants (via Accept-Encoding HTTP header). With “new” approach it seems that such feature was “removed” and instead user is expected to provide “separate modules” for each of the view formats, which is rather inconvenient in such cases. Is there a “better way” or it is what I had to live and provide my own abstraction on top of that?

7 Likes