diff --git a/modules/ROOT/pages/authentication-and-authorization/impersonation-and-user-switching.adoc b/modules/ROOT/pages/authentication-and-authorization/impersonation-and-user-switching.adoc index a1787c74..0bbb164c 100644 --- a/modules/ROOT/pages/authentication-and-authorization/impersonation-and-user-switching.adoc +++ b/modules/ROOT/pages/authentication-and-authorization/impersonation-and-user-switching.adoc @@ -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 @@ -42,7 +42,7 @@ const neo4jGraphql = new Neo4jGraphQL({ const schema = await neo4jGraphql.getSchema(); -const server = new ApolloServer({ +const server = new ApolloServer({ schema, }); @@ -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 @@ -86,7 +86,7 @@ const neo4jGraphql = new Neo4jGraphQL({ const schema = await neo4jGraphql.getSchema(); -const server = new ApolloServer({ +const server = new ApolloServer({ schema, }); @@ -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 @@ -140,7 +140,7 @@ const neo4jGraphql = new Neo4jGraphQL({ const schema = await neo4jGraphql.getSchema(); -const server = new ApolloServer({ +const server = new ApolloServer({ schema, }); @@ -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 @@ -184,7 +184,7 @@ const neo4jGraphql = new Neo4jGraphQL({ const schema = await neo4jGraphql.getSchema(); -const server = new ApolloServer({ +const server = new ApolloServer({ schema, }); diff --git a/modules/ROOT/pages/integrations/apollo-federation.adoc b/modules/ROOT/pages/integrations/apollo-federation.adoc index e1254dd0..c8da5b98 100644 --- a/modules/ROOT/pages/integrations/apollo-federation.adoc +++ b/modules/ROOT/pages/integrations/apollo-federation.adoc @@ -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] ===== @@ -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]