Quote:
res.json[datauniswap, datasushiswap, datauniswap, datacurvefinance]
As far as I can see,
res.json
is a function. You need to call that function, passing in the data you want to return.
You also need to send the variables containing the data you've loaded, not the functions used to load the data.
For example:
res.json({ uniswap: exchangeone, sushiswap: exchangetwo, curvefinance: exchangethree, quickswap: exchangequattro });
Once you've fixed that, you'll probably want to fix your code to issue the external requests in parallel, rather than sequentially:
server.get('/coingeckotest', async (req, res) => {
const promises = [
datauniswap(),
datasushiswap(),
datacurvefinance(),
dataquickswap()
];
const uniswap: await promises[0],
sushiswap: await promises[1],
curvefinance = await promises[2],
quickswap = await promises[3];
cacheTime = Date.now();
res.json({ uniswap, sushiswap, curvefinance, quickswap });
});