does anyone know how put vs post calls map to the trpc procedures provided? (query vs mutation)
I did check out the documentation but i only mentions GET and POST, not PUT .
https://trpc.io/docs/rpc
GET -> QUERY
POST -> MUTATE
PUT -> MUTATE ?
The reason I'm asking is because i have to create some put, post and get endpoints that were specified in a codebase but now i need to map them to trpc complements.
My best guess is that both POST and PUT calls send the payload in the request body, but GET calls send the payload in the url parameters. Since the query method lets you send information through the request body, i'm thinking i'll just use mutate call to replace the put functionality
Open to thoughts from the community on this
HTTP RPC Specification | tRPC
Methods Type mapping
Solution:Jump to solution
You can use trpc-openapi to have both PUT and POST etc, but the tRPC client will still call the POST endpoint for mutations I believe.
2 Replies
Solution
You can use trpc-openapi to have both PUT and POST etc, but the tRPC client will still call the POST endpoint for mutations I believe.
I see, I'll give that a shot