Skip to content

Instantly share code, notes, and snippets.

@colinfwren
Created April 17, 2022 21:08
Show Gist options
  • Save colinfwren/df0cb1d507f7e96417dccb5a7796875f to your computer and use it in GitHub Desktop.
Save colinfwren/df0cb1d507f7e96417dccb5a7796875f to your computer and use it in GitHub Desktop.
Setting up Neo4J GraphQL server
import { gql, ApolloServer } from 'apollo-server'
import { Neo4jGraphQL } from '@neo4j/graphql'
import neo4j from 'neo4j-driver'
const typeDef = gql``; // Type Defs for schema
const driver = neo4j.driver(
'http://localhost:7687', // Bolt URL for Neo4J
neo4j.auth.basic('neo4j', 's3cr3t') // Username & password for Neo4J
);
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
neoSchema.getSchema().then((schema) => {
const server = new ApolloServer({
schema
});
server.listen().then((serverConfig) => {
console.log('GraphQL server started', serverConfig)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment