@@ -143,6 +143,44 @@ await startStandaloneServer(server, {
143143
144144----
145145
146+ ==== Transaction configuration in context
147+
148+ [source, javascript, indent=0]
149+ ----
150+ import { ApolloServer } from "@apollo/server";
151+ import { startStandaloneServer } from "@apollo/server/standalone";
152+ import { Neo4jGraphQL } from "@neo4j/graphql";
153+ import neo4j from "neo4j-driver";
154+
155+ const typeDefs = `#graphql
156+ type User @node {
157+ name: String
158+ }
159+ `;
160+
161+ const driver = neo4j.driver(
162+ "bolt://localhost:7687",
163+ neo4j.auth.basic("username", "password")
164+ );
165+ const session = driver.session();
166+ const transactionConfig = {
167+ timeout: 60 * 1000,
168+ metadata: {
169+ "my-very-own-metadata": "is very good!"
170+ }
171+ };
172+
173+ const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
174+
175+ const server = new ApolloServer({
176+ schema: await neoSchema.getSchema(),
177+ });
178+
179+ await startStandaloneServer(server, {
180+ context: async ({ req }) => ({ req, transaction: transactionConfig }),
181+ });
182+ ----
183+
146184[[driver-configuration-database-compatibility]]
147185== Database compatibility
148186
0 commit comments