create a file called .env and provide a following code
PORT=3002
MONGO_DB_URL=mongodb://localhost/taskdb
query GetAllTask {
tasks {
id
name
}
}
query GetTaskById{
task(id: "1") {
id
name
completed
}
}
mutation CreateTask {
createTask(input:{
name: "New Task"
completed: false
userId: "1"
}) {
id
name
completed
}
}
query getAllUsers {
users {
id
name
tasks {
id
name
completed
}
}
}
query getUserById {
user {
id
name
email
tasks {
id
name
completed
}
}
}
{
"Authorization": "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImdyZWdAZ21haWwuY29tIiwiaWF0IjoxNjAyMzkwNjk1LCJleHAiOjE2MDI0NzcwOTV9.GmCVoWPtc21xyRB5n80h0YGISzuc6iXs9Q9topv6YLg"
}
mutation loginUser {
login(input: { email: "greg@gmail.com", password: "123456" }) {
token
}
}
mutation {
register(userInfo: {
username: "John Doe",
password: "Password",
age: 123
}) {
errors {
field
message
}
user {
id
username
initial
}
}
login(userInfo: {
username: "John Doe",
password: "Password",
age: 123
})
}
subscription {
newUser {
id
username
initial
}
}