Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const neo4j = require('neo4j-driver').v1;
const request = require('request');
// SET YOUR VALUE FOR THE PASSWORD AND THE IP ADDRESS WHERE THE NEO4J SERVER CAN BE ACCESSED!!
var user = "neo4j", password = "neo4j1", uri = "bolt://192.168.188.142:7687"
const driver = neo4j.driver(uri, neo4j.auth.basic(user, password));
const session = driver.session(neo4j.WRITE);
var countriesDocumentURL = "https://raw.githubusercontent.com/mledoze/countries/master/countries.json"
async function addConstraints(tx) {
console.log(`Adding Constraints`)
return tx.run('CREATE CONSTRAINT ON (l:Language) ASSERT l.name IS UNIQUE').then(tx.run('CREATE CONSTRAINT ON (c:Country) ASSERT c.name IS UNIQUE').then(tx.run('CREATE CONSTRAINT ON (r:Region) ASSERT r.name IS UNIQUE').then(tx.run('CREATE CONSTRAINT ON (c:Country) ASSERT c.code IS UNIQUE'))));
}
async function addLanguages(tx, languages) {
console.log(`Adding languages`)
var s = '';
languages.forEach(element => s = s.concat(`CREATE (:Language {name: '${element}'})
`))
console.log("Statement " + s)
return tx.run(s);
}