$chiubaca / notes / fleeting / 2021-03-07
  • 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 a resolvers file.
    • Implementation of the typeDefs can now be carried out in the resolvers file. Rise and repeat for every CRUD operations required for your app.
Edit on GitHub ✏️

Hey I'm Alex Chiu 👋. These are my notes for literally anything.

I'm using the Zettelkasten method to organise my thoughts here.

My more polished writings are published to my main blog at chiubaca.com

Follow me on: Github / X (Twitter) / Mastodon / LinkedIn