Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Here the user to impersonate is taken from a HTTP header `User`:
[.tabbed-example]
====

[.include-with-Typescript]
[.include-with-JavaScript]
=====
[source, typescript, indent=0]
[source, javascript, indent=0]
----
import { ApolloServer } from "@apollo/server";
import { startStandaloneServer } from "@apollo/server/standalone";
import { Neo4jGraphQL, Neo4jGraphQLContext } from "@neo4j/graphql";
import { Neo4jGraphQL } from "@neo4j/graphql";
import neo4j from "neo4j-driver";

const typeDefs = `#graphql
Expand All @@ -42,7 +42,7 @@ const neo4jGraphql = new Neo4jGraphQL({

const schema = await neo4jGraphql.getSchema();

const server = new ApolloServer<Neo4jGraphQLContext>({
const server = new ApolloServer({
schema,
});

Expand All @@ -59,13 +59,13 @@ console.log(`🚀 Server ready at: ${url}`);
----
=====

[.include-with-JavaScript]
[.include-with-Typescript]
=====
[source, javascript, indent=0]
[source, typescript, indent=0]
----
import { ApolloServer } from "@apollo/server";
import { startStandaloneServer } from "@apollo/server/standalone";
import { Neo4jGraphQL } from "@neo4j/graphql";
import { Neo4jGraphQL, Neo4jGraphQLContext } from "@neo4j/graphql";
import neo4j from "neo4j-driver";

const typeDefs = `#graphql
Expand All @@ -86,7 +86,7 @@ const neo4jGraphql = new Neo4jGraphQL({

const schema = await neo4jGraphql.getSchema();

const server = new ApolloServer({
const server = new ApolloServer<Neo4jGraphQLContext>({
schema,
});

Expand All @@ -113,13 +113,13 @@ An example of configuring user switching on a per request basis can be found in
[.tabbed-example]
====

[.include-with-TypeScript]
[.include-with-JavaScript]
=====
[source, typescript, indent=0]
[source, javascript, indent=0]
----
import { ApolloServer } from "@apollo/server";
import { startStandaloneServer } from "@apollo/server/standalone";
import { Neo4jGraphQL, Neo4jGraphQLContext } from "@neo4j/graphql";
import { Neo4jGraphQL } from "@neo4j/graphql";
import neo4j from "neo4j-driver";

const typeDefs = `#graphql
Expand All @@ -140,7 +140,7 @@ const neo4jGraphql = new Neo4jGraphQL({

const schema = await neo4jGraphql.getSchema();

const server = new ApolloServer<Neo4jGraphQLContext>({
const server = new ApolloServer({
schema,
});

Expand All @@ -157,13 +157,13 @@ console.log(`🚀 Server ready at: ${url}`);
----
=====

[.include-with-JavaScript]
[.include-with-TypeScript]
=====
[source, javascript, indent=0]
[source, typescript, indent=0]
----
import { ApolloServer } from "@apollo/server";
import { startStandaloneServer } from "@apollo/server/standalone";
import { Neo4jGraphQL } from "@neo4j/graphql";
import { Neo4jGraphQL, Neo4jGraphQLContext } from "@neo4j/graphql";
import neo4j from "neo4j-driver";

const typeDefs = `#graphql
Expand All @@ -184,7 +184,7 @@ const neo4jGraphql = new Neo4jGraphQL({

const schema = await neo4jGraphql.getSchema();

const server = new ApolloServer({
const server = new ApolloServer<Neo4jGraphQLContext>({
schema,
});

Expand Down
51 changes: 25 additions & 26 deletions modules/ROOT/pages/integrations/apollo-federation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,31 @@ This how-to guide sets up the project using ES Modules, which allows the usage o
[.tabbed-example]
====

[.include-with-JavaScript]
=====

. Create a `src` directory with an empty `index.js` file to contain the entrypoint to your code:
+
[source, bash]
----
mkdir src
touch src/index.js
----
+
. Replace the default `scripts` entry in your `package.json` file with the following:
+
[source, json]
----
{
// ...etc.
"scripts": {
"start": "node index.js"
}
// other dependencies
}
----
=====

[.include-with-Typescript]
=====

Expand Down Expand Up @@ -126,32 +151,6 @@ For more information on the available options, see the https://www.typescriptlan
}
----
=====

[.include-with-JavaScript]
=====

. Create a `src` directory with an empty `index.js` file to contain the entrypoint to your code:
+
[source, bash]
----
mkdir src
touch src/index.js
----
+
. Replace the default `scripts` entry in your `package.json` file with the following:
+
[source, json]
----
{
// ...etc.
"scripts": {
"start": "node index.js"
}
// other dependencies
}
----
=====

====

[start=4]
Expand Down