ts-rest / ts-rest

RPC-like client, contract, and server implementation for a pure REST API
https://ts-rest.com
MIT License
2.85k stars 159 forks source link

ts-rest Microservices #730

Open LeulAria opened 5 months ago

LeulAria commented 5 months ago

Is their a way to use ts-rest in microservice backend basically to create multiple contract's and aggregate them into one big contract.

LeulAria commented 5 months ago

Hello, we tried to solve the issue.

This is what we did:

Create a new file called libs/example-microservice/util-aggregated-api/src/lib/example-microservice-util-aggregated-api.ts to aggregate the posts and users contracts into one big contract.

You can review changes in this commit: jacks-sam1010@124ad0e.

Caution

Disclaimer: The concept of solution was created by AI and you should never copy paste this code before you check the correctness of generated code. Solution might not be complete, you should use this code as an inspiration only.

Latta AI seeks to solve problems in open source projects as part of its mission to support developers around the world. Learn more about our mission at https://latta.ai/ourmission . If you no longer want Latta AI to attempt solving issues on your repository, you can block this account.

so does each router / microservice have it's own initContract() ? then we are aggregating them into the main contract ?