【问题标题】:How can I define mutations or queries without any parameters in graphql?如何在 graphql 中定义没有任何参数的突变或查询?
【发布时间】:2019-08-09 02:31:45
【问题描述】:

我对 graphql 有疑问:

type Mutation {
    clearEsLog(): string
    clearRabbit(): string
}

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

UnhandledPromiseRejectionWarning:语法错误:预期名称,找到)

【问题讨论】:

    标签: javascript node.js typescript graphql nestjs


    【解决方案1】:

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

    type Mutation {
        clearEsLog: string
        clearRabbit: string
    }
    

    【讨论】:

      猜你喜欢
      • 2018-07-02
      • 2017-07-26
      • 2022-11-25
      • 2019-05-24
      • 2022-06-23
      • 2018-09-17
      • 2016-03-04
      • 2018-12-11
      • 2017-11-07
      相关资源
      最近更新 更多