HTTP request in Node.js or other JavaScript framework

You should always consider using the Object provided by the MV* framework. If the JS framework doesn’t have a built-in support for communicating with the server (which I highly doubt), you can opt to work directly with the low-level methods of the XMLHttpRequest object itself or use a general utility library such as JQuery.

On the Node.js environment

XMLHttpRequest is a built-in object in web browsers.

It is not distributed with Node; you have to install it separately using npm.

That said, Node comes with the http module which is the normal tool for choice for making HTTP requests from Node.

 

 

Advertisements