Skip to content

Question on "respond with HTML, not JSON" / partial or complete HTML? #1557

Answered by Telroshan
vguhesan asked this question in Q&A
Discussion options

You must be logged in to vote

To each their own I guess, but I personnally only send {{partial-content}} when applicable

  • There's no point in sending a whole page's HTML if you were only going to use a small portion of it
  • The backend would spend unnecessary time & resources fetching any required data & generating all the parts of the generated HTML response, that wouldn't even be used by the client as only the {{partial-content}} would be (the rest would be ditched away)
  • By using a templating system in your backend, you won't have to duplicate any code but simply factor your {{partial-content}} in its own template/component/whatever, and use that in your bigger page as well as your partial content routes
  • I understand …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vguhesan
Comment options

Answer selected by vguhesan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants