node.js - Parse JSON data which is a response to http get request -


I am trying to develop a website using NODE.js which sends a request to some third party server and is being reacted. JSON format is the fastest way to filter data, what's the best way? Suppose I want to query some books of a specific author, what is the best practice?

  • Should I handle it in the callback? And then parse the whole reaction object?
  • Or should I filter the response when getting myself in the stream using the pipe?

Note that I intend to develop a website that users will have to answer in real time, so time is very valuable.

I think you can use callback to retrieve JSON data and make them real Use the websocket to pass filtered data to clients in time.

  http.get ("http: // www. Google.com/index.html", function (ridge) {console.log ("received response: "+ Res.statusCode);}). ('Error', function (e) {console.log ("error found:" + E.message);});  

You can use socket.io for node.js


Comments