Problems rendering output in nodejs from a neo4j server <p>I'm pretty sure this is really simple but I thought I should ask on here. I'm creating a function in nodejs that looks for a user in a neo4j server then renders that or outputs that onto the webpage.I am able to query the neo4j sever and output that to the console fine but I do not know how to output that info to the webpage. /** * GET / * Neo4j Graph page. */</p> <pre><code>exports.getGraph = function(req, res) { res.render('graph', { title: 'Graph', user: User }); }; /** * GET / * Get user from neo4j */ var neo4j = require('neo4j'); var db = new neo4j.GraphDatabase('http://neo4j:password@localhost:7474'); exports.getNeoUser = function (req, res){ db.cypher({ query: 'MATCH (user:User {email: {email}}) RETURN user', params: { email: 'alice@example.com', }, }, callback); function callback(err, results) { if (err) throw err; var result = results[0]; if (!result) { console.log('No user found'); } else { var user = result['user']; console.log(user); } } function output(req, res) { res.render('graph', { title: 'Graph', user: User }); }; }; </code></pre> <p>If I leave it like this nothing is rendered although the app won't crash. It starts loading the page but never actually finishes. I think it might be some sort of race condition. I have tried placing this res.render inside the callback function but that results in a method undefined error.</p>