Created
April 17, 2022 21:08
-
-
Save colinfwren/df0cb1d507f7e96417dccb5a7796875f to your computer and use it in GitHub Desktop.
Setting up Neo4J GraphQL server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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