3 ms·
Well, if you're asking the endpoint for an HTML representation of something, and it responds with template portions and rules for combining them based on data (
by kbenson 8y ago
Well, if you're asking the endpoint for an HTML representation of something, and it responds with template portions and rules for combining them based on data (React,Vue), doesn't it make sense to respond with all the date needed to actually build it right then and there?
If someone requests /users.json I return JSON. If someone requests /users.html I return a document with rules in JS for how to build the HTML based on the data (Vue) and the JSON to build it with. In both cases the JSON is the important part, the Vue stuff included in the HTML version is just a transform on that data to be applied by the client. In that respect, I think not including the desired JSON would by hacky, requiring a separate request for the actual data you requested initially.