Re:Htmx
by dysoco on Wednesday December 14, 2022 @02:31PM
(#33988854)
Curious at why are you using DRF with HTMX; isn't DRF more common when you need to return JSON for example and render in the frontend? Wouldn't returning Django templates to use with HTMX be the best option? Or is it for POST requests?
[ Parent
| on HN ]
I still have some API things and I like the router and serializers.
Re:Htmx
by TechBro8615 on Wednesday December 14, 2022 @05:05PM
(#33991284)
Does the server renderer call the API routes via HTTP, or does it have a more direct path to fetching the same data? If so, what interface does it use - loopback or the public address of the server?
In my experience this distinction has been a source of complexity in server-rendered apps that consume the same API as the client but at a different address, leading to problems like untrusted self-signed certificates, mismatching hostnames, and leaky proxy routes.
Or perhaps none of your server rendered pages even call the API directly, and you just expose it for other clients?
Re:Htmx
by FlyingSnake on Wednesday December 14, 2022 @04:19PM
(#33990754)
Web isn’t the only interface. DRF might also serve REST API to mobile or webhooks etc.