Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Create mutations to create a book and an author in DB, implement requests to get list of books with authors. Solve N+1 problem.

Notifications You must be signed in to change notification settings

rhiskey/nodejs-gql-ts-Public

Repository files navigation

GitHub language count Discord GitHub code size in bytes GitHub GitHub followers

GitHub Repo stars

nodejs-graphql

A test case.


Using at least 2 libraries type-graphql and typeorm:

  1. Create mutations to create a book and an author in the database.
  2. Implement a request to get a list of books with authors. It is important to limit yourself to two queries to the database for one graphql query. For author use fieldResolver.
  3. Tests:
  • Creating an author
  • Book creation
  • Receive books without authors
  • Receiving books with authors Graphql schema types:
type Book {
  bookId: number;   
  name: string;
  pageCount: number; 
  authorId: number;  
  author: Author; 
}


type Author {
  authorId: number;
  name: string;
} 

An example of a query to graphql:

query {
  books () {
    name
    author {
      name
    }
  }
}

To run JS - npm run start
To run TS - npm run startts

About

Create mutations to create a book and an author in DB, implement requests to get list of books with authors. Solve N+1 problem.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published