Thursday, 8 June 2017

Handle global variable in node.js server

I have a node.js server that reads messages from a rabbitmq server. Every message contains an url that returns a json object whit specifications to download some jsx code.

The node.js server gets the code from the urls and compiles it with webpack. My problem is that I need to keep aware of the information of the json objects in the webpack compilation instance, because I need to print the downloaded objects in the index page.

  • Node Server -- Get messages --> RabbitMQ Server
  • RabbitMQ Server -- Return messages --> Node Server
  • Node Server -- Get code [from URL] --> URL service
  • URL service -- Return code --> Node Server
  • Node Server: Compile downloaded code.

I don't know if I was clear. I tried to use global variables and module.exports, but did not work. Maybe I am missing something, I am a kind of beginner in JS, node and webpack.



via Sebastian Garavano

No comments:

Post a Comment