Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-08-2022 02:59 AM
Hello, I have to neo4j databases and I want to serve data from each using a single nodejs server. How do I achieve this.
01-05-2023 03:58 PM
You can specify the Neo4j database name to use for resolving GraphQL queries in the GraphQL context object. For example:
const { Neo4jGraphQL } = require("@neo4j/graphql");
const neo4j = require("neo4j-driver");
const typeDefs = `
type User {
name: String
}
`;
const driver = neo4j.driver(
"bolt://localhost:7687",
neo4j.auth.basic("neo4j", "password")
);
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
neoSchema.getSchema().then((schema) => {
const server = new ApolloServer({
schema,
context: { driverConfig: { database: "my-database" } },
});
});
context can be a function that determines which Neo4j database to use at query time. See the docs here: https://neo4j.com/docs/graphql-manual/current/driver-configuration/
All the sessions of the conference are now available online