- Starting to understand some nice coding architecture patterns when using Type ORM with Apollo from reading Full-Stack-React-TypeScript-and-Node.
- Table schemas are all written in the TypeORM syntax in the
repo
folder. Note these also act as the types used by TypeScript too! - Specic queries that need to be made to each table can ben written in corresponding file in the format
<TableName>Repo
, there can be any arbitary logic in the file in this file and TypeORM provide really every API required to to query, filter and join data which can be made use off. The functions can be exported then used in GraphQL resolvers or even in just a regular REST API. - Nect we define our GrapQL scheama, queryies and mutations in a
typeDefs
file which acts as the contract for implmentation in aresolvers
file. - Implementation of the
typeDefs
can now be carried out in theresolvers
file. Rise and repeat for every CRUD operations required for your app.
- Table schemas are all written in the TypeORM syntax in the