击中Express端点时触发Graphql突变

时间:2018-08-22 11:00:44

标签: graphql

    const server = new GraphQLServer({
  typeDefs: 'src/schema.graphql',
  resolvers,
  resolverValidationOptions: {
    requireResolversForResolveType: false
  },
  context: req => ({
    ...req,
    db: new Prisma({
      typeDefs: 'src/generated/prisma.graphql', // the Prisma DB schema
      endpoint: process.env.PRISMA_ENDPOINT,    // the endpoint of the Prisma DB service (value is set in .env)
      secret: process.env.PRISMA_SECRET,        // taken from database/prisma.yml (value is set in .env)
      debug: true,                              // log all GraphQL queries & mutations
    }),
  }),
})

  server.express.use('/ChangeFalseToTrue/:Id', function(req,res){
      //fire Mutation Here?

    } )

好的,实际上,我们有一个运行正常的graphql服务器,当您点击 / changefalsetoTrue 端点时,我想运行一个变异,该端点会根据ID更新节点。我看过但未能找到确切的例子。任何帮助/资源将不胜感激。

0 个答案:

没有答案