How to call an API in REACT using Moralis

ok im just getting frustrated.

here is the code in my cloud function:

Moralis.cloud.define("getPrice", async (request) => {
  let url = 'https://deep-index.moralis.io/api/v2/erc20/' + request.params.address + '/price'
  logger.info(url);
  return Moralis.Cloud.httpRequest({
  	url: url,
    params: {chain: 'eth', chain_name: 'mainnet'},
    headers: {
    'accept': 'application/json',
   	'X-API-Key': xxx
    }    
  }).then(function(httpResponse){
    return httpResponse.data;
  }, function(httpResponse){
  		logger.info("error");
    	logger.info(httpResponse);
  })
});

There’s got to be a simple way to call this cloud function and simply get the ETH price from my react app.

someone please help…

Hi,
It should be
Moralis.Cloud.define("getPrice", async (request) => {
instead of
Moralis.cloud.define("getPrice", async (request) => {

You should remove the API_KEY from your post