My problem is that I don't want to create a mess in my backend.
Here's how the http handler looks right now.
func (h logisticsHandler) getItem(w http.ResponseWriter, r *http.Request) {
id, err := strconv.ParseInt(chi.URLParam(r, "id"), 10, 64)
if err != nil {
return
}
item, _ := h.service.GetItem(r.Context(), id)
res := newItemReponse(item)
render.JSON(w, r, res)
}
```It only supports Json, but now HTMX would require me to also return html. I guess I could create a new handler that handles the requests on a different route, but then I have to do all the extraction and user auth twice.
So then I had the idea to use `?type=json` param and return json by default... but I also don't like that.
Then I had the idea to switch based on the request headers, HTMX apparently sets `hx-header` to true. Maybe I switch and check if it exists and either return html or josn?
But it all feels like code clutter?