TypeError: Moralis.Cloud.httpRequest is not a function

Hi,

I am Receiving this error within a function, what am i doing wrong? Thank You.

const Moralis = require(ā€œmoralis/nodeā€);
const { timer } = require(ā€œrxjsā€);

async function fancyFunction() {

const result = await Moralis.Cloud.httpRequest({
url: ā€œwww.blah.com/1.jsonā€,
headers: {
ā€˜Content-Typeā€™: ā€˜application/json;charset=utf-8ā€™
}
});

console.log(result);

}

fancyFunction()

I think that Moralis.Cloud.httpRequest works only in cloud code and not in a local nodejs script

ah alright thanks, is there another way to grab json data? Hmm

From https://docs.moralis.io/moralis-server/cloud-code/httprequest

Moralis Server includes Moralis.Cloud.httpRequest . It allows you to send HTTP requests to any HTTP server. This function takes an options object to configure the call.

you can do that from a cloud function, but the syntax that you pasted there for the entire code doesnā€™t look like cloud code

thanks yes your right just watched the video tutorial! thanks for your help!