7 تغريدة Apr 13, 2023
What is tRPC?
A thread 👇🧵
As TypeScript grows in popularity, tRPC offers a TypeScript-based addition to traditional REST and GraphQL APIs.
tRPC allows you to build and consume APIs in a typesafe manner.
📌 How does it work?
tRPC uses functions (procedures) instead of schemas to remotely call the backend.
You can share types between client and server, ensuring full type safety for inputs, outputs, and errors.
📌 What is type safety for APIs?
It means, the server and client already agree on the form of data.
So, when the data gets to the server or client, it is already validated.
📌 Benefits of type safety
- Static typing that can help catch errors on build time rather than run time.
- Autocompletion and checks for bad types.
- Data validation that improves API security.
📌 Downsides of tRPC
- It requires both your front and back end to use TypeScript.
- It works best when your frontend and backend are close together like a monorepo.
That’s all for now! Follow @Rapid_API for more exclusive content. 🐙💙

جاري تحميل الاقتراحات...