Install modules and generate Prisma client based on prisma/schema.prisma
.
npm install && npx prisma generate && npm start
To make GraphQL queries with the built in UI, open browser at: http://localhost:4000/graphql
.
To view the database contents, run:
npx prisma studio
{
users {
id
email
name
}
}
{
user(id: 2) {
id
email
name
}
}
{
tasks {
id
title
authorId
completed
}
}
{
user(id: 2) {
id
email
name
tasks {
id
completed
title
}
}
}
mutation {
createUser(email: "[email protected]", name:"Mika Lakanen") {
id
email
name
}
}
mutation {
createTask(title: "Task2", authorId: 2) {
id
title
}
}
mutation {
updateUser(id: 2, email: "ville2@com") {
id
email
name
}
}
mutation {
deleteUser(id: 2) {
id
email
name
}
}