Created
November 30, 2019 07:31
-
-
Save jimmycrequer/c9fbc9b77d743aa30a85ea820a0be7ab to your computer and use it in GitHub Desktop.
geography-main.js
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
const neo4j = require('neo4j-driver').v1 | |
const readlineSync = require('readline-sync') | |
let driver, session | |
async function main() { | |
driver = neo4j.driver( | |
'bolt://localhost', | |
neo4j.auth.basic('neo4j', 'letmein') | |
) | |
session = driver.session() | |
while (true) { | |
console.log(`Choose a game`) | |
console.log(`1. Guess country from capital`) | |
console.log(`2. Guess country from neighbors`) | |
const answer = readlineSync.question('> ') | |
switch (answer) { | |
case '1': | |
await guessCountryFromCapital() | |
break | |
case '2': | |
await guessCountryFromNeighbors() | |
break | |
default: | |
return | |
} | |
} | |
session.close() | |
driver.close() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment