# Neo4j GraphQL with new @apollo/server

**URL:** <https://community.neo4j.com/t/neo4j-graphql-with-new-apollo-server/61455>\
**Category:** Drivers & Stacks\
**Created:** [March 15, 2023, 7:04pm UTC](https://community.neo4j.com/t/neo4j-graphql-with-new-apollo-server/61455 "2023-03-15T19:04:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![david\_loving](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/david_loving/32/21180_2.png) [@david\_loving](https://community.neo4j.com/u/david_loving)\
**Post date:** [March 15, 2023, 7:04pm UTC](https://community.neo4j.com/t/neo4j-graphql-with-new-apollo-server/61455/1 "2023-03-15T19:04:07Z")

</div>

Are there examples of how to use Neo4j GraphQL with the new @apollo/server library? Your documentation and examples are out of date and use the apollo-server library that is deprecated and goes obsolete in October.

---

<div class="post-metadata">

**Author:** ![lyonwj](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/lyonwj/32/27358_2.png) [@lyonwj](https://community.neo4j.com/u/lyonwj)\
**Post date:** [March 15, 2023, 9:20pm UTC](https://community.neo4j.com/t/neo4j-graphql-with-new-apollo-server/61455/2 "2023-03-15T21:20:44Z")

</div>

Here's a simple example I just tried (it ends up being very similar to the getting started example).

Install dependencies:

```auto
npm i @apollo/server @neo4j/graphql graphql neo4j-driver

```

`index.js` :

```js
const { ApolloServer } = require("@apollo/server");
const { startStandaloneServer } = require("@apollo/server/standalone");
const { Neo4jGraphQL } = require("@neo4j/graphql");
const neo4j = require("neo4j-driver");

const NEO4J_URI = "neo4j://localhost:7687";
const NEO4J_USER = "neo4j";
const NEO4J_PASSWORD = "letmeinnow";

const driver = neo4j.driver(
  NEO4J_URI,
  neo4j.auth.basic(NEO4J_USER, NEO4J_PASSWORD)
);

const typeDefs = `
type Movie {
  title: String!
  actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN)
}

type Actor {
  name: String!
  movies: [Movie!]! @relationship(type:"ACTED_IN", direction: OUT)
}
`;

const neoSchema = new Neo4jGraphQL({ typeDefs, driver });

neoSchema.getSchema().then(async (schema) => {
  const server = new ApolloServer({
    schema,
  });

  const { url } = await startStandaloneServer(server);
  console.log(`Server ready at ${url}`);
});

```

Start the GraphQL server:

```auto
node index.js

```

Open Apollo Studio at `localhost:4000` and run a GraphQL query:

```auto
query {
  movies(options: { limit: 10 }) {
    title
  }
}

```

```auto
{
  "data": {
    "movies": [
      {
        "title": "Toy Story"
      },
      {
        "title": "Jumanji"
      },
      {
        "title": "Grumpier Old Men"
      },
      {
        "title": "Waiting to Exhale"
      },
      {
        "title": "Father of the Bride Part II"
      },
      {
        "title": "Heat"
      },
      {
        "title": "Sabrina"
      },
      {
        "title": "Tom and Huck"
      },
      {
        "title": "Sudden Death"
      },
      {
        "title": "GoldenEye"
      }
    ]
  }
}

```

I like the standalone mode - running the Apollo Studio Sandbox locally instead of redirecting to the hosted version is nice.

---

<div class="post-metadata">

**Author:** ![david\_loving](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/david_loving/32/21180_2.png) [@david\_loving](https://community.neo4j.com/u/david_loving)\
**Post date:** [March 16, 2023, 1:19pm UTC](https://community.neo4j.com/t/neo4j-graphql-with-new-apollo-server/61455/3 "2023-03-16T13:19:38Z")

</div>

Thank you! I will put this to use today!
