2

So I have the following routes: /creator/item and /creator/item/price. Both the schemas of the two routes have a mutation called updateOne. However, when I call the route of /creator/item/price it matches /creator/item instead.

Is this intended? Is there a workaround or do I have to make a completely unique path name for it?

A. L
  • 11,695
  • 23
  • 85
  • 163

1 Answers1

0

It seems like the order of definition matters.

Before:

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

After:

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
    })
)
A. L
  • 11,695
  • 23
  • 85
  • 163