Question

I am thinking of using node.js as a gateway. I want to implement several frontends (browser, apps etc.) which get served by node.js with data over websockets. Node.js cannot fetch this data directly from a database but node.js should get it from a backend through an interface which makes it easy to replace the backend. So I was thinking of using a restful layer or a publish /subscribe protocol like MQTT as interface. Ok ... question: Is this a good idea? Can node.js act as a gateway and what modules do you recommend for such a purpose? enter image description here

Was it helpful?

Solution

Is this a good idea?

I'd think of it this way. Yes, this is a use case well-suited to node.js's strengths.

what modules do you recommend for such a purpose?

  • app server: express.js
  • web sockets: socket.io (maybe socks.js)
  • HTTP from gateway to back end: hyperrequest or superagent or request.js
  • if you need any straight-up HTTP proxy functionality: node-proxy
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top