OtterSwims996
OtterSwims9969mo ago

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:
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.
Jump to solution
2 Replies
Solution
BeBoRE
BeBoRE9mo ago
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.
OtterSwims996
OtterSwims996OP9mo ago
I see, I'll give that a shot