-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
715230a
commit 003b97b
Showing
10 changed files
with
277 additions
and
216 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import neo4j from 'neo4j-driver-lite'; | ||
import dotenv from 'dotenv'; | ||
|
||
dotenv.config(); | ||
|
||
const uri = process.env.DB_HOSTNAME || 'bolt://localhost:7687'; | ||
const user = process.env.DB_USERNAME || 'neo4j'; | ||
const password = process.env.DB_PASSWORD; | ||
|
||
const driver = neo4j.driver(uri, neo4j.auth.basic(user, password)); | ||
const session = driver.session(); | ||
|
||
const cypherUrl = 'https://raw.githubusercontent.com/neo4j-graph-examples/movies/main/scripts/movies.cypher'; | ||
|
||
async function loadAndRunCypherQueries() { | ||
try { | ||
const response = await fetch(cypherUrl); | ||
const cypherQueries = await response.text(); | ||
const queries = cypherQueries.split(';').filter(query => query.trim() !== ''); | ||
|
||
for (const query of queries) { | ||
await session.run(query); | ||
console.log(`Executed query: ${query}`); | ||
} | ||
} catch (error) { | ||
console.error('Error loading or executing cypher queries:', error); | ||
} finally { | ||
await session.close(); | ||
await driver.close(); | ||
} | ||
} | ||
|
||
loadAndRunCypherQueries(); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.