We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://trpc.io/
http
websocket
輕度 API
經典 API
巨量 API
1. 寫 API 文件 2. BE/ FE 同時開發 3. 修改 API 文件 4. BE/ FE 同時修改
因為目前的工作也算是個半個 full-stack, Front-end 這有個 nodeJS server 要自己維運, 所以我們的開發流程會是這樣:
1. 寫 API 文件 2. BE 開發 (Api/Cron Job) 3. FE 開發 4. 修改 Api 5. 修改 Cron Job (可能忘了改) 6. 修改 Api 文件 (可能忘了改) 7. FE 修改 (可能忘了改)
type unsafety!
目前 codebase 也常常會有這種程式碼 (不管是 FE 或 server side)
const doLogin = async (payload: any) => { const { data } = await axios.post('url', payload); if (data.isSuccess) { ... } } // Cannot read properties of undefined (reading 'data')
使用 Typescript 的泛型可以增加安全性, 但 FE 和 server side 要兩邊維護 很麻煩
interface LoginPayload { username: string; password: string; } interface LoginResult { isSucces: boolean; } const doLogin = async (payload: LoginPayload) => { const { data } = await axios.post<LoginResult>('url', payload); if (data.isSuccess) { ... } }
https://trpc.io/docs/quickstart
官網這邊 quickstart 內坎的 source code 可以玩玩
玩了一下之後我覺得專案如果有幾下特點的話會很適合
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What is tRPC?
https://trpc.io/
http
/websocket
protocolvs REST / GraphQL
My Paint Point
正常開發 (前後分離)
目前工作上開發流程
因為目前的工作也算是個半個 full-stack, Front-end 這有個 nodeJS server 要自己維運, 所以我們的開發流程會是這樣:
APIs In CodeBase
目前 codebase 也常常會有這種程式碼 (不管是 FE 或 server side)
使用 Typescript 的泛型可以增加安全性, 但 FE 和 server side 要兩邊維護 很麻煩
Demo
https://trpc.io/docs/quickstart
官網這邊 quickstart 內坎的 source code 可以玩玩
Advantage
Disadvantage
我認為適合使用 tRPC 的時候
玩了一下之後我覺得專案如果有幾下特點的話會很適合
The text was updated successfully, but these errors were encountered: