The schema specifies the API operations of your GraphQL server. TypeGraphQL allows you to define a schema using TypeScript classes and decorators. The schema is generated at runtime, and is defined by the following classes:
./src/PostResolvers.ts
./src/UserResolvers.ts
./src/User.ts
./src/Post.ts
./src/UserCreateInput.ts
./src/PostCreateInput.ts
Below are a number of operations that you can send to the API using the GraphQL Playground.
Feel free to adjust any operation by adding or removing fields. The GraphQL Playground helps you with its auto-completion and query validation features.
query {
feed {
id
title
content
published
author {
id
name
email
}
}
}
See more API operations
mutation {
signupUser(data: {
name: "Sarah",
email: "[email protected]"
}
) {
id
}
}
mutation {
createDraft(
data: {
title: "Join the Prisma Slack",
content: "https://slack.prisma.io"
email: "[email protected]"
}
) {
id
published
}
}
mutation {
publish(id: __POST_ID__) {
id
published
}
}
Note: You need to replace the
__POST_ID__
-placeholder with an actualid
from aPost
item. You can find one e.g. using thefilterPosts
-query.
{
filterPosts(searchString: "graphql") {
id
title
content
published
author {
id
name
email
}
}
}
{
post(id: __POST_ID__) {
id
title
content
published
author {
id
name
email
}
}
}
Note: You need to replace the
__POST_ID__
-placeholder with an actualid
from aPost
item. You can find one e.g. using thefilterPosts
-query.
mutation {
deleteOnePost(id: __POST_ID__) {
id
}
}
Note: You need to replace the
__POST_ID__
-placeholder with an actualid
from aPost
item. You can find one e.g. using thefilterPosts
-query.