Monday, 3 April 2017

Serving Latest Data With Each Request Node.js

I working on a web interface for an Electrical Engineering project where current status of a robot is stored in a postgre table. The idea is for anyone with access to the website to be able to send commands and see the current status of the robot. I'm using express.js with pug view engine. I have a router object process the request and res.render the index page. What is the best way to query the database when the user requests the index and have the table data available for the pug view engine to process it.

In addition what is the best way to send an update to the client when something changes. A client side request for new information every 5 seconds? Or are websockets the only way.



via jackana3

No comments:

Post a Comment