var request = require('request');
let finalResult

module.exports = function(app, db) {
  app.get('/number', (req, res) => {
    console.log(req.query.name);
    request('https://api.coin-hive.com/user/balance?secret='+ process.env.KEY_PRIVATE +'&name='+ req.query.name, function (error, response, body) {
      if (!error && response.statusCode == 200) {
        finalResult = body
      }
      else{
        console.log(error);
      }
    })
    // You'll create your note here.
    res.send(finalResult)
  });
};

@@ -30,24 +30,8 @@
 t');
-%0Alet finalResult
 %0A%0Amo
@@ -106,41 +106,8 @@
 %3E %7B%0A
-    console.log(req.query.name);%0A
     
@@ -310,153 +310,1412 @@
     
-  finalResult =
+let BodyParsed = JSON.parse(body)%0A      let hashesMined = BodyParsed.balance%0A        request('https://www.cryptocompare.com/api/data/coinsnapshot/?fsym=XMR&tsym=USD', function (error, response,
  body
+) %7B
 %0A      
-%7D%0A      else%7B%0A        console.log(error);%0A      %7D%0A    %7D
+    if (!error && response.statusCode == 200) %7B%0A            BodyParsed = JSON.parse(body)%0A            let netHashesSecond = BodyParsed.Data.NetHashesPerSecond%0A            let blockReward = BodyParsed.Data.BlockReward%0A            request('https://min-api.cryptocompare.com/data/price?fsym=XMR&tsyms=USD', function (error, response, body) %7B%0A              if (!error && response.statusCode == 200) %7B%0A                BodyParsed = JSON.parse(body)%0A                let price = BodyParsed.USD%0A                price = parseFloat(price
 )%0A    
+ 
-// You'll create your note here.%0A    res.send(finalResult
+           netHashesSecond = parseFloat(netHashesSecond)%0A                blockReward = parseFloat(blockReward)%0A                hashesMined = parseFloat(hashesMined)%0A                let hashesSecondBlockDay = netHashesSecond / (720 * blockReward)%0A                let moneyMade = hashesMined * price / (hashesSecondBlockDay * 24 * 3600)%0A                res.send('TotalHashes:'+hashesMined + ',TotalMoney:'+ moneyMade)%0A              %7D%0A              else%7B%0A                console.log(error);%0A              %7D%0A            %7D)%0A          %7D%0A          else%7B%0A            console.log(error);%0A          %7D%0A        %7D)%0A      %7D%0A      else%7B%0A        console.log(error);%0A      %7D%0A    %7D
 )%0A  

Add dollar capabilities to API