how can I make an http request from the hosted javascript code?

How can I make an HTTP request from the hosted javascript files, to another server? Is there a utility available, or will the standard node.js library work?

This is described in the documentation:

https://backendless.com/documentation/business-logic/js/bl_external_hosts.htm

Hmmm … I guess I’m not sure when to use that feature, and when to use the javascript under Files -> Web -> Scripts …

This is the documentation for custom business logic (event handlers and timers), it does not apply to hosted scripts (the code you can run in web/scripts).

Standard node.js library should work there.

I see. Okay. How can I add existing node modules to the hosted scripts then?

You can upload them to the web\scripts\node_modules directory. The simplest way is to upload a zip and then unzip it in console.

Here is an example of http request using standard Node.js http module

Here we make the request to http://api.backendless.com and ‘redirect’ its response body

http://take.ms/k7bE1</img>

Code for copy/paste