如何在 graphql 中定义没有任何参数的突变或查询?

Ibr*_*ria 3 javascript node.js typescript graphql nestjs

我对 graphql 有问题:

type Mutation {
    clearEsLog(): string
    clearRabbit(): string
}
Run Code Online (Sandbox Code Playgroud)

我使用 Nestjs,当我运行应用程序时,错误是:

UnhandledPromiseRejectionWarning: Syntax Error: Expected Name, found )

Kim*_*ern 7

当您的查询或更改中没有参数时,您必须省略括号():

type Mutation {
    clearEsLog: string
    clearRabbit: string
}
Run Code Online (Sandbox Code Playgroud)