I run a simple http server with Node.js:
var http = require('http');
var fs = require('fs');
var index = fs.readFileSync('index.html');
var sensor = require('ds18x20');
var temp = sensor.get('sensorID');
http.createServer(function(req,res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end(index);
}).listen(80);
console.log(temp);
my index.html file:
<html>
<head>
</head>
<body>
My temperature:
//space for variable: temp
</body>
</html>
Now, I want to print the server-side variable: temp in my index.html file. But I have no idea how to do it.
Maybe somebody can help me with the exchange of Variables from the server to the client.