Examples
On the GitHub repository there are a few simple examples
of how to use different TypeGraphQL
features and how well they integrate with 3rd party libraries.
To run an example, simply go to the subdirectory (e.g. cd ./simple-usage
), and then start the server (npx ts-node ./index.ts
).
Each subdirectory contains a examples.graphql
file with predefined GraphQL queries/mutations/subscriptions that you can use in Apollo Studio (http://localhost:4000) and play with them by modifying their shape and data.
Basics
Advanced
- Enums and unions
- Subscriptions (simple)
- Subscriptions (using Redis) **
- Interfaces
- Extensions (metadata)
Features usage
- Dependency injection (IoC container)
- Authorization
- Validation
- Types inheritance
- Resolvers inheritance
- Generic types
- Mixin classes
- Middlewares and Custom Decorators
- Query complexity
3rd party libs integration
- TypeORM (manual, synchronous) *
- TypeORM (automatic, lazy relations) *
- MikroORM *
- Typegoose *
- Apollo Federation
- Apollo Federation 2
- Apollo Cache Control
- GraphQL Scalars
- TSyringe
* Note that we need to provide the environment variable DATABASE_URL
with connection parameters to your local database
** Note that we need to provide the environment variable REDIS_URL
with connection parameters to your local Redis instance