Javascript express graphql-匹配父路由的子例程
因此,我有以下路线:Javascript express graphql-匹配父路由的子例程,javascript,node.js,graphql,graphql-js,express-graphql,Javascript,Node.js,Graphql,Graphql Js,Express Graphql,因此,我有以下路线:/creator/item和/creator/item/price。这两条路径的模式都有一个名为updateOne的突变。但是,当我调用/creator/item/price的路由时,它会匹配/creator/item 这是有意的吗?是否有解决方法,或者我必须为其创建一个完全唯一的路径名?似乎定义的顺序很重要 之前: // - item const item_schema = require("./graphql/creator/items") app.use(
/creator/item
和/creator/item/price
。这两条路径的模式都有一个名为updateOne
的突变。但是,当我调用/creator/item/price
的路由时,它会匹配/creator/item
这是有意的吗?是否有解决方法,或者我必须为其创建一个完全唯一的路径名?似乎定义的顺序很重要 之前:
// - item
const item_schema =
require("./graphql/creator/items")
app.use(
"/creator/item",
graphqlHTTP({
schema:
item_schema,
graphiql:
env !== "production",
formatError
})
)
const item_price_schema =
require("./graphql/creator/item/prices.js")
app.use(
// "/creator/updateOne/price",
"/creator/item/price",
graphqlHTTP({
schema:
item_price_schema,
graphiql:
env !== "production",
formatError
})
)
之后:
const item_price_schema =
require("./graphql/creator/item/prices.js")
app.use(
// "/creator/updateOne/price",
"/creator/item/price",
graphqlHTTP({
schema:
item_price_schema,
graphiql:
env !== "production",
formatError
})
)
// - item
const item_schema =
require("./graphql/creator/items")
app.use(
"/creator/item",
graphqlHTTP({
schema:
item_schema,
graphiql:
env !== "production",
formatError
})
)
看来定义的顺序很重要 之前:
// - item
const item_schema =
require("./graphql/creator/items")
app.use(
"/creator/item",
graphqlHTTP({
schema:
item_schema,
graphiql:
env !== "production",
formatError
})
)
const item_price_schema =
require("./graphql/creator/item/prices.js")
app.use(
// "/creator/updateOne/price",
"/creator/item/price",
graphqlHTTP({
schema:
item_price_schema,
graphiql:
env !== "production",
formatError
})
)
之后:
const item_price_schema =
require("./graphql/creator/item/prices.js")
app.use(
// "/creator/updateOne/price",
"/creator/item/price",
graphqlHTTP({
schema:
item_price_schema,
graphiql:
env !== "production",
formatError
})
)
// - item
const item_schema =
require("./graphql/creator/items")
app.use(
"/creator/item",
graphqlHTTP({
schema:
item_schema,
graphiql:
env !== "production",
formatError
})
)