I've never actually used a backend that couldn't return arbitrary content types. Those exist?
I've never actually used a backend that couldn't return arbitrary content types. Those exist?
Any serious framework would be able to handle this without any hiccups.
To migrate to our flashy new Angular V1 application, we added a application/json content-type that instead of returning the template, returned the data that the template used. So we could endpoint-by-endpoint migrate to the SPA we were building.
Was simply a matter of making the data required for the views a bit more advertised internally, so the controllers could instead not render the views when the content-type is json.
It wouldn't be the prettiest HTML but you could work with it via CSS and JS.
For sure. Most of the backends we write only return JSON. If you request HTML or any other content-type, we return nothing. We just don't implement it.
If you write your backend from scratch and only intend for it to be used only with your web front-end, you can make it return bits of HTML (I have several applications in jQuery that work like this -- the value of the response just gets inserted via ("#id").html(val)).
Our current backends are written to support multiple generic consumers of which a web front-end is only one.
Much easier to use client-side templating as suggested by the author.