I have a fetch method:
fetch("http://localhost:3000/coin/" + String(TICKER_CODE))
.then((res) => {
console.log(res.text());
}) .catch((err) => {
/* handle errors */
console.log("ERROR on fetch request", err)
});}
and my response.send
app.get('/coin/:coinID', (req, response) => {
sends this format:
var data_to_save = {
"name" : null,
"ticker": null,
"max_supply": null,
"circulating_supply": null,
"description": null,
"price": null,
"cmc_rank": null,
"percent_change_1h": null,
"percent_change_24h": null,
"percent_change_7d": null,
"percent_change_30d": null}
but for some reason, I get this when I console.log my res?
Response {type: 'cors', url: 'http://localhost:3000/coin/BTC', redirected: false, status: 200, ok: true, …}
and this when I console.log(res.text()) or res.json()
Promise {<pending>}
[[Prototype]]:
Promise
[[PromiseState]]: "fulfilled"
[[PromiseResult]]: 42123.461982801804
I can’t seem to grasp what I’m doing wrong, I am currently sending the object as it is, and even tried to JSON.stringify it and send it over.