T
TanStack•4mo ago
conscious-sapphire

Why createServerFn only accepts HTTP GET and POST?

Pretty simple yet unanswered question, why createServerFn only accepts HTTP methods GET and POST?
6 Replies
conventional-tan
conventional-tan•4mo ago
what are you missing?
conscious-sapphire
conscious-sapphireOP•4mo ago
All the other HTTP methods, PUT, PATCH, DELETE... For example, for creating a server function for deleting a user, I have to choose between GET or POST, but which one should I choose? 😅😅
conventional-tan
conventional-tan•4mo ago
the only meaningful differences between GET and POST are GET: - has no body, input data in querystring - is cached by the browser POST: - has body - not cached by the browser all the other verbs add nothing to that
conscious-sapphire
conscious-sapphireOP•4mo ago
Oh okay, understood, I can live with it, but I still feel like it is a weird restriction from the library 😅
conventional-tan
conventional-tan•4mo ago
you are not building a REST API here if you want that, use an API route
conscious-sapphire
conscious-sapphireOP•4mo ago
I knoww, but the HTTP semantics are still there 😭

Did you find this page helpful?