/learn-typegraphql

How To Build a GraphQL API with TypeGraphQL and TypeORM

Primary LanguageTypeScript

TypeGraphQL & TypeORM Example

How To Build a GraphQL API with TypeGraphQL and TypeORM. Read the article.

forked from rahmanfadhil/learn-typegraphql

Differences:

  • node-config used for configuration
  • refactor file names
  • update all deps
  • add Docker+Compose configuration
  • use postgres db in containers

How to use

Localhost

npm install
npm run start

This will start node server with database stored in sqlite3 file.

GraphQL playground at http://localhost:4000

Docker

docker-compose up -d

This will start node server with database and pg-admin in different containers.

GraphQL playground at http://localhost:4000

PG Admin GUI at http://localhost:4100 use admin/admin as login/password

Query examples

Hello world

{ hello }

create Book

mutation {
  createBook(data:{
    title: "Megabook",
    author: "Megamind"
  }) {
    id, title, author, isPublished
  }
}

get all books

{ books
  { id, title, author }
}