4 ms·
I agree that the objection doesn't hold up given how many websites are made, but I think they mean that a REST API shouldn't be returning HTML, which is true. U
by Thorentis 6y ago
I agree that the objection doesn't hold up given how many websites are made, but I think they mean that a REST API shouldn't be returning HTML, which is true. Unfortunately using the replace feature would mean rewriting existing APIs.
Or, you could use the client side template feature of htmx which supports rendering JSON into HTML using a templating language: https://htmx.org/extensions/client-side-templates/ https://htmx.org/extensions/client-side-templates/
- recursivedoubts 6y ago> REST API shouldn't be returning HTML, which is true. No, it isn't. REST implies HATEOAS, and JSON isn't a hypertext. Calling JSON APIs REST-ful was always a mistake. http://intercoolerjs.org/2016/05/08/hatoeas-is-for-humans.html http://intercoolerjs.org/2016/05/08/hatoeas-is-for-humans.ht...
- inimino 6y ago> a REST API shouldn't be returning HTML Why do you think so? It might interest you to know that Roy Fielding defined REST before JSON was invented.
- goto11 6y agoREST is the architectural style of the web, so returning HTML is the primary use case.