I want to make a website that can display a plot with node.js. I also want to update the data every minute without refreshing the whole page. I am new to node.js and would like to learn how to use "get" request to update the data with a server.
Here I created a server in app.js:
http.createServer(function(req, res){
console.log('You are listening to port 3000');
fs.readFile('./controllers/index.html', function(err, data){
res.writeHead(200,{'Content-Type': 'text/html'});
res.write(data)
res.end();
});
}).listen(3000);
If my index.html is:
<html>
<body>
<h1>My Datasets</h1>
<p>Some data plot</p>
</body>
</html>
and I want to change the data plot every minute. How do I make a request from the frontend and provide the required data with the server?
Thanks.
via Deidara
No comments:
Post a Comment