JayJayDee / TypeGraphQL-TypeORM-Example

An example for TypeGraphQL + TypeORM with rich test cases.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeGraphQL-TypeORM-Example

An example GraphQL server application which written with TypeGraphQL + TypeORM.

Features

  • High code readability.
  • Test codes.
  • Lazy initialization.
  • Using TypeDI as a container & dependency injector.

DB E-R Diagram

the DB relation diagram is same as follows. you can also check this out in src/orm-entities/ directory. implemented with TypeORM entities.

DB E-R Diagram

How to configure application

this application uses dotenv as a configuration loader. you can place .env.dev dotenv file in project root directory to configure run this application.

MYSQL_HOST=127.0.0.1
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=my-pokemon-rocks
MYSQL_DATABASE=pokemon
HTTP_PORT=4000

How to run

$ npm install
$ npm run dev

How to run unit test with Mocha + Chai

$ npm run test

Next step

  • nested GraphQL schema example. -> done.
  • nested (releation between tables) entities example -> done
  • GraphQL mutations with permission.

About

An example for TypeGraphQL + TypeORM with rich test cases.


Languages

Language:TypeScript 96.4%Language:JavaScript 3.6%