最近我在我的Express服务器上实现了一些模式和解析器。我通过/graphql
成功地对它们进行了测试,现在我想在从REST API访问时调用我实现的查询,如下所示:
//[...]
//schema and root correctly implemented and working
app.use('/graphql', graphqlHTTP({
schema: schema,
rootValue: root,
graphiql: true,
}));
//I start the server
app.listen(port, () => {
console.log('We are live on ' + port);
});
//one of many GET handlers
app.get("/mdc/all/:param", function(req, res) {
//call one of the (parametrized) queries here
//respond with the JSON result
});
我应该如何在我的GET处理程序中调用使用GraphQL定义的查询?我如何向它们传递参数?
谢谢!