Skip to content

Commit

Permalink
Merge pull request #418 from ali-ince/1.7-example-address-resolver
Browse files Browse the repository at this point in the history
Add custom resolver example
  • Loading branch information
lutovich committed Oct 9, 2018
2 parents 15deb86 + 57cb54b commit 85aa92f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/v1/examples.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,28 @@ describe('examples', () => {
};
});

it('config custom resolver example', done => {
// tag::config-custom-resolver[]
function createDriver(virtualUri, user, password, addresses) {
return neo4j.driver(virtualUri, neo4j.auth.basic(user, password), {
resolver: (address) => addresses,
});
}

function addPerson(name) {
const driver = createDriver("bolt+routing://x.acme.com", user, password, ['a.acme.com:7575', 'b.acme.com:7676', 'c.acme.com:8787']);
const session = driver.session(neo4j.WRITE);

session.run('CREATE (n:Person { name: $name })', {name: name}).then(() => {
session.close();
driver.close();
});
}
// tag::config-custom-resolver[]

done();
});

it('custom auth example', done => {
const principal = user;
const credentials = password;
Expand Down

0 comments on commit 85aa92f

Please sign in to comment.