I\'m using Node.js and I\'m having issues communicating with a client.
I define Express:
var express = require(\"express\");
var app
You are basically telling express to render your index page and providing a value for the name variable, but that doesn't necessarily make the name var available in your client side javascript. You need to edit your index template to display the name variable in the page.
The syntax varies depending on the templating engine you are using (jade, ejs, dustjs).
Another solution is to use an ajax call in your client page's javascript and use res.json on the server instead to send the data. Then you can evaluate name in the console. Ex using jquery:
index.html:
$.get( "/getvar", function( data ) {
name = data.name;
});
server.js:
app.get("/getvar", function(req, res){
res.json({ name: "example" });
});