Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/468.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript express graphql-匹配父路由的子例程_Javascript_Node.js_Graphql_Graphql Js_Express Graphql - Fatal编程技术网

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
    })
)