#Actions vs Endpoints?
8 messages · Page 1 of 1 (latest)
The first part of the Actions section in the docs explains the benefits pretty well
So then why would someone ever use endpoints?
Building an API
Fwiw I like to use actions for all internal requests that I need for my app, interacting with a DB etc
And endpoints anytime my app needs to handle a request from outside the application, my personal example is a discord bot that queries my API to get "total upvotes" on an item
I second Matthew's approach. Endpoints are for stuff that you want to be publicly accessible/exposed easily, actions are internal things
That makes sense!
So if I'm not making an api that would be used outside of my frontend, since I'm going to be returning HTMX, I could just use actions for everything.
And then if I was ever interested in making an API other clinets could interact with, maybe for JSON, I would use server api endpoints
Thank you so much