kiaksarg / nestjs-graphql-tolkien

Nestjs GraphQL best practice. Schema is based on Tolkien's Arda world data from lotr.fandom.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nestjs-graphql-tolkien

NestJS GraphQL with TypeORM and MariaDB (MySQL)

Screenshot-Fellowship-of-the-Ring

Graphql-Fellowship-of-the-Ring.mp4

Database Migration

Check or change the database name, user and password in .env file

  1. Create database
  2. Create database user
  3. Make changes in .env file
  4. Run migrate command:
npm run migrate
  1. To generate migration file, if needed (it is already generated, so this step can be skipped):
npm run migration:gen

Database seeding

To seed the database run:

npm run seed:run

Sample Query

{
  cultures(
    options: {
      take: 100
      skip: 0
      sort: { name: ASC }
      filter: { name: { search: "Fellowship" } }
    }
  ) {
    totalItems
    items {
      id
      name
      characters(
        options: {
          take: 10
          skip: 0
          sort: { name: ASC }
          filter: { name: { search: "Gandalf" } }
        }
      ){
        totalItems
        items{
          id
          name
        }
      }
    }
  }
}

Entities

Characters

Locations

Cultures

Races

Artefacts

Battles

Quotes

About

Nestjs GraphQL best practice. Schema is based on Tolkien's Arda world data from lotr.fandom.com

License:MIT License


Languages

Language:TypeScript 99.4%Language:JavaScript 0.2%Language:Dockerfile 0.2%Language:Shell 0.1%