type-graphql-practice

Practice TypeGraphQL with Apollo, Express, Postgres, Redis, Typeorm and Typescript

MIT License

Stars
2
Committers
2

type-graphql-practice

TypeGraphQL with Apollo, Express, Postgres, Redis, Typeorm and Typescript


cp .env.example .env # modify variables

cp ormconfig.example.json ormconfig.json # modify variables

docker-compose up

# connect to docker database container
create database <database-name>; # ormconfig.json

yarn start

Visit http://localhost:4000/graphql

Caveats

  1. Make sure in graphql-playground settings, following is set: "request.credentials": "include"

Available Query and Mutations

check schema docs

mutation {
  register(data:{
    firstName:"",
    ...
  }) {
    id
    firstName
    ...
  }
}
mutation {
  login(email:"", password:"") {
    id
    firstName
    ...
  }
}
query {
  me {
    id
    firstName
    lastName
    email
    name
  }
}

Reference

Ben Awad TypeGraphQL series playlist

Testing Setup


# locate test-utils

cp ormconfig.test.example.json ormconfig.test.json # copy and modify variables

yarn test

yarn test:watch # watch mode - lacks resetting database