Skip to content
Snippets Groups Projects
Commit f659a522 authored by Dorus's avatar Dorus
Browse files

fix: fixed db connection

parent f4faf25b
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
To run a neo4j db container locally
```
docker run --name neo4j -p 7687:7687 -p 7474:7474 -d --env NEO4J_AUTH=neo4j/password neo4j:latest
docker run --rm --name neo4j -p 7687:7687 -p 7474:7474 -d --env NEO4J_AUTH=neo4j/password neo4j:latest
```
To access the neo4j container
......
......@@ -29,24 +29,27 @@ if (require.main === module) {
// 3rd password
// 4th output file name
const uri: string = process.argv[1] || "bolt://localhost:7687"; // default neo4j port
const username: string = process.argv[2] || "username";
const password: string = process.argv[3] || "passowrd";
const uri: string = process.argv[2] || "bolt://localhost:7687"; // default neo4j port
const username: string = process.argv[3] || "neo4j";
const password: string = process.argv[4] || "password";
const outputFile: string = process.argv[4] || 'output.json'; // Default output file if none provided
const outputFile: string = process.argv[5] || 'output.json'; // Default output file if none provided
// connect to neo4j
try
{
console.log(`Connecting to: ${uri}`);
const driver = neo4j.driver(uri, neo4j.auth.basic(username, password));
const session = driver.session();
}
catch(error)
{
console.log("Error connecting to neo4j")
console.log(`Error connecting to neo4j: ${error}` )
}
console.log(`Connected succesfully`);
// reccursive function that executes queries
const promptQuery = () => {
rl.question('query: ', async (cypherQuery) => {
......@@ -62,5 +65,6 @@ if (require.main === module) {
});
};
promptQuery();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment