I am new To Node js and I need a quick help.
I have a node.js app receiving data from another app through a GET request like this: GET /api/users?data=26'
- every 30 sesonds. My node app code looks like this:
var express = require('express');
var app = express();
var port = process.env.PORT || 8080
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
var router = express.Router();
router.get('/api/users', function(req, res) {
var query = req.param('data');
//I need to pass data to the view without refreshing browser
});
app.use(router);
app.listen(port)
I need to pass the data to the view(I have a template home.jade
) without a user refreshing the browser.So since the request every 30 seconds a user will see the data changing every 30 seconds without refreshing the browser. How do I accomplish this? Thank you in advance.