|
|
|
|
|
by what2
764 days ago
|
|
As with everything in engineering the definitive answer is "it depends". If your JSON API is guided by your UI then you are gonna have a fun time keeping with the changes (been there, done that). Sure you know that to add a new field on your page you will need to add it on the API's JSON, then on the JS client code, then on your client template... Compare this to adding it on the HTML generated on the server and... done! There is value in differentiating between Data API and Hypermedia (UI) API, you can read more about it here https://htmx.org/essays/hypermedia-apis-vs-data-apis/ And note that is not an universal truth applicable on all cases because "it depends" |
|
with a frontend framework i add it to the html template in the frontend, and i add it to the function/class that generates the json output. and again to the database if not already there.
as far as i can tell, that's the same amount of code that needs to be changed.
yes, there is one piece of extra code to generate json, but that is either a standard library or something you write once. either way, the json generator should not need to be changed.