Skip to content
Merged
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
38 changes: 38 additions & 0 deletions modules/ROOT/pages/driver-configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,44 @@ await startStandaloneServer(server, {

----

==== Transaction configuration in context

[source, javascript, indent=0]
----
import { ApolloServer } from "@apollo/server";
import { startStandaloneServer } from "@apollo/server/standalone";
import { Neo4jGraphQL } from "@neo4j/graphql";
import neo4j from "neo4j-driver";

const typeDefs = `#graphql
type User @node {
name: String
}
`;

const driver = neo4j.driver(
"bolt://localhost:7687",
neo4j.auth.basic("username", "password")
);
const session = driver.session();
const transactionConfig = {
timeout: 60 * 1000,
metadata: {
"my-very-own-metadata": "is very good!"
}
};

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

const server = new ApolloServer({
schema: await neoSchema.getSchema(),
});

await startStandaloneServer(server, {
context: async ({ req }) => ({ req, transaction: transactionConfig }),
});
----

[[driver-configuration-database-compatibility]]
== Database compatibility

Expand Down