3 ms·
> The point about a JSON API is a good point In a well-designed system, these two are not mutually exclusive but simply two facets of the same request pipeline
by CharlieDigital 3y ago
> The point about a JSON API is a good point
In a well-designed system, these two are not mutually exclusive but simply two facets of the same request pipeline. The JSON API simply serializes the model as JSON.
The HTMX-specifc API applies a template/transform over the model and returns HTML instead. If one thinks of hypertext as another serialization target, it's easy to see how one would easily be able to serve both JSON for pure APIs and hypertext for HTMX.
- zaphar 3y agoOh definitely. You could control it with the `Accept: text/html` http header too so you can use the same endpoint. But as I said, you need to take that into consideration if you adopt htmx.