grapql@16 放弃了对位置参数的长期弃用支持,请改为传递一个对象

An *_*ife 4 apollo graphql apollo-server

    const { ApolloServer, gql } = require('apollo-server');
    
    // A schema is a collection of type definitions (hence "typeDefs")
    // that together define the "shape" of queries that are executed against
    // your data.
    const typeDefs = gql`
      # Comments in GraphQL strings (such as this one) start with the hash (#) symbol.
    
      # This "Book" type defines the queryable fields for every book in our data source.
      type Book {
        title: String
        author: String
      }
    
      # The "Query" type is special: it lists all of the available queries that
      # clients can execute, along with the return type for each. In this
      # case, the "books" query returns an array of zero or more Books (defined above).
      type Query {
        books: [Book]
      }
    `;
const books = [
  {
    title: 'The Awakening',
    author: 'Kate Chopin',
  },
  {
    title: 'City of Glass',
    author: 'Paul Auster',
  },
];

// Resolvers define the technique for fetching the types defined in the
// schema. This resolver retrieves books from the "books" array above.
const resolvers = {
  Query: {
    books: () => books,
  },
};

// The ApolloServer constructor requires two parameters: your schema
// definition and your set of resolvers.
const server = new ApolloServer({ typeDefs, resolvers });

// The `listen` method launches a web server.
server.listen().then(({ url }) => {
  console.log(`  Server ready at ${url}`);
});
Run Code Online (Sandbox Code Playgroud)

这是我从 Apollo GraphQL 官方网站复制的代码。我使用 graphql 16.3 和 apollo-server 2.25.3。我不知道该消息告诉我要解决什么问题。请帮帮我。非常感谢你们!

小智 5

从他们的文档看来 apollo-server 2 不支持 graphql >15

https://www.apollographql.com/docs/apollo-server/migration/

我要么迁移到 apollo-server 3,要么将 graphql 降级到版本 15。