- run git clone
https://github.com/gbols/End-to-End-Test-With-Jest.git
- cd into /src
- run
docker compose up -d
- run
prisma deploy -e ../config/dev.env
- run
prisma generate
- cd to the root directory
- run
npm install
- run
npm run dev
- cd into /src
- run
deploy -e ../config/test.env
- run
prisma generate
- run
npm run test
- The
start
branch- This branch contains all the beginnner starter files and can be modified when following the article step by step.
- The
final
branch- This branch contains what the project will look like when we are finished with the start branch.
For a Comprehesive list open http://localhost:4000/ on your local browser and click on the docs button.
User Type
mutation {
createUser(data: {
name: "John Doe",
email: "john@example.com",
password: "iamjohndoe",
}){
token
user {
name
email
id
password
}
}
}
mutation{
loginUser(data:{
email: "john@example.com",
password: "iamjohndoe",
}){
user {
name
id
email
password
}
token
}
}
query{
users{
email
id
todos{
title
body
}
}
}
Todo Type
- make sure to copy the token returned from loginUser or creatUser mutation.
- Add the token in the headers section like this
{
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSm9obiBEb2UiLCJ1cGRhdGVkQXQiOiIyMDE5LTExLTEyVDE1OjI4OjMwLjk3NloiLCJlbWFpbCI6ImpvaG5AZXhhbXBsZS5jb20iLCJpZCI6ImNrMncwZzA3NDAwd3UwNzY2N2t4bWVuajUiLCJjcmVhdGVkQXQiOiIyMDE5LTExLTEyVDE1OjI4OjMwLjk3NloiLCJwYXNzd29yZCI6IiQyYiQwNCRnaHVTdTJHSWtzUHA3NEY1R1Y3am5lWW90LnJnbzFPM1o1WlcuQ3A5a21sT3RsMmpzR3NhSyIsImlhdCI6MTU3MzU3MzM0NH0.bNByjNB2ed-p4vQzYpWy2nJ7mZaGE2vwoW_d6tvyjbE"
}
mutation {
createTodo(data: {
title: "Buy Indomie",
body: "Buy yam from the supermarket for everyone to eat at 10pm"
}){
title
}
}
mutation{
updateTodo(id:"string ID of TODO to Update", data:{
title: "Buy Beans Instead"
}){
title
body
}
}
query {
todos{
title
body
id
author{
name
email
}
}
}