Simple GraphQL API to be used as a guidance from the topics covered on my workshop called "GraphQL Academy"
The goal of this workshop is not to suggest/advocate for specific GraphQL libraries, thus don't feel obliged of choosing the same dependencies from this repo as the choices for your project
However, you can find the reasoning behind my choices in this pull request
Not every topic from the workshop will be referenced here, but I'll try as much as possible to link implementations so that you can use as a basis for your personal project / challenges proposed on each class
- Initial GraphQL API setup with Apollo Server
- Schema implementation using TypeGraphQL (Annotation-based implementation)
- Resolvers + data layer with Prisma
- Reproducing N+1 issue
- Mutations with payload, input types and error as data handling
- Pagination: Cursor & Offset styles
- Introduce interface type to decouple schema from the persistence layer
- Generate SDL artifact from code definitions
yarn install
Make sure to have a Postgres database running in order to execute the migration script. Create a .env file based on .env.example and update the variables according to your database configuration.
cp .env.example .env
PORT=3000
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/graphql-basis?schema=public"
Run the migrate-dev
script, which will migrate tables defined on Prisma schema and execute a seed script
to populate some initial data in order to use the API locally
yarn migrate-dev
`
yarn dev