小编wil*_*aba的帖子

如何使用 GraphQL 在嵌套对象上创建突变?

我正在尝试创建一个 graphql 突变来用其他对象数组更新对象字段。这是我的架构:

    type Guide {
      _id: ID!
      first_name: String!
      last_name: String
      email: String!
      phone: String!
      creator: User!
    }

    input GuideInput {
      _id: ID!
      first_name: String!
      last_name: String
      email: String!
      phone: String!
    }

    type Trip {
      _id: ID!
      name: String!
      description: String
      location: String
      start_date: String
      start_time: String
      duration: Int
      creator: User!
      guides: [Guide!]
      guests: [Guest!]
    }

    input TripInput {
      name: String
      description: String
      location: String
      start_date: String
      start_time: String
      duration: Int
      guides: [GuideInput]
    }

    type RootQuery {
      trips: [Trip!] …
Run Code Online (Sandbox Code Playgroud)

mongodb node.js graphql

8
推荐指数
1
解决办法
6982
查看次数

zsh: 当 $ curl -s -X localhost:60702/api/bundle?name=light%20reading | 找不到匹配项时 jq'.'

我正在阅读 Jim Wilson 的 Node.js The Right Way 一书。我目前正在尝试使用 PUSH 请求创建具有指定名称的新包。* curl -X POST http://:/api/bundle?name=

但是,当我使用命令时: $ curl -s -X POST localhost:60702/api/bundle?name=light%20reading | jq '.'

我得到的不是指示已创建 Bundle 的 JSON,而是: zsh: no matches found: localhost:60702/api/bundle?name=light%20reading

该命令应该使用 POST 请求来创建一个新的我的所有代码都与书中列出的代码完全相同。有任何想法吗?

node.js express elasticsearch

2
推荐指数
2
解决办法
5479
查看次数

标签 统计

node.js ×2

elasticsearch ×1

express ×1

graphql ×1

mongodb ×1