Skip to content

Aura example #594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 2, 2020
Merged

Aura example #594

merged 2 commits into from
Jul 2, 2020

Conversation

mneedham
Copy link
Contributor

@mneedham mneedham commented Jul 1, 2020

No description provided.

@mneedham mneedham requested a review from 2hdddg July 1, 2020 15:33
@mneedham
Copy link
Contributor Author

mneedham commented Jul 2, 2020

This is how it'll look on the Aura connect page:

image

I couldn't think of a better way to define the Bolt URL/User/Password so that they can use the Aura placeholders, so I've put them in comments that get removed when the code is pulled into Aura land.

Happy to change that if there's a cleaner way to do it.

Copy link
Contributor

@2hdddg 2hdddg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice

const writeResult = await session.writeTransaction(tx =>
tx.run(writeQuery, { person1Name, person2Name })
)
writeResult.records.forEach(row => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick, but record is perhaps clearer than row

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have updated row -> record

)
writeResult.records.forEach(row => {
console.log(
`Created friendship between: ${row.get('p1').properties.name}, ${
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also nitpick, could be more clear if we use intermediate node variable
person1Node = row.get('p1')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

await driver.close()
// end::driver-introduction-example[]

expect(await consoleLoggedMsg).toEqual(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this part isn't visible in Aura page?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh, so it'll only include what's between these lines:

// tag::driver-introduction-example[]

and

// end::driver-introduction-example[]

This is how we pull in the samples on the Aura side:

include::https://raw.githubusercontent.com/mneedham/neo4j-javascript-driver/aura-example/test/examples.test.js[tag="driver-introduction-example-imports", indent=0]
include::https://raw.githubusercontent.com/mneedham/neo4j-javascript-driver/aura-example/test/examples.test.js[tag="driver-introduction-example-variables", indent=0]
include::https://raw.githubusercontent.com/mneedham/neo4j-javascript-driver/aura-example/test/examples.test.js[tag="driver-introduction-example", indent=0]

That's pointing at my branch at the moment, but I'll update it to use the official repo after it's merged.

@2hdddg 2hdddg merged commit 88e646d into neo4j:4.1 Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants