is trpc good for rest apis?

Is trpc good for making rest apis? cause i feel like api/trpc/posts.getLatest isnt that compeling of a url vs api/posts/latest. is their a way to change trpc to do something like api/posts/latest? or am i fundamentaliy looking at trpc wrong?
6 Replies
Neto
Neto2mo ago
no trpc is the "best" way to make client calls from specific backends
itsanameidk
itsanameidkOP2mo ago
Alright I think I get it now thanks
Ayoub K
Ayoub K5w ago
There's an extension for OpenAPI https://github.com/jlalmes/trpc-openapi I don't know if the project is still actively maintained, but I used it about a year ago and it seemed to do the job well.
GitHub
GitHub - jlalmes/trpc-openapi: OpenAPI support for tRPC 🧩
OpenAPI support for tRPC 🧩. Contribute to jlalmes/trpc-openapi development by creating an account on GitHub.
cje
cje5w ago
trpc-openapi is unmaintained iirc. and either way you get none of the value of trpc if it's being consumed by non trpc clients.
cje
cje5w ago
a lot of frameworks have nice openapi integrations now, for example here's hono https://hono.dev/examples/zod-openapi
Zod OpenAPI - Hono
Web framework built on Web Standards for Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Node.js, and others. Fast, but not only fast.
Ayoub K
Ayoub K5w ago
Yes, that true. For my use case, I just needed to expose 4 endpoints in a project built with trpc so I opted for trpc-openapi
Want results from more Discord servers?
Add your server