lucaszdevmmyers616
AxiosError: connect ECONNREFUSED 127.0.0.1:80
try {
const lotteriesArray = [];
const promises = lotteries.map(async (lottery, index) => {
const response = await lotteryApi.getLottery(lottery);
lotteriesArray[index] = {
lottery_name: response.nome,
amount: response.valor_estimado_proximo_concurso,
color: lotteryColors[index],
date: response.data_concurso,
tender_number: response.numero_concurso,
description: lotteryDescription[index]
};
});
Promise.all(promises).then(() => {
res.status(200).json({
status: 200,
lotteries: lotteriesArray
});
}).catch(error => {
res.status(500).json({
error: "Server error, please try again later."
});
});
} catch (error) {
res.status(500).json({
error: "Server error, please try again later."
});
}
77 replies
AxiosError: connect ECONNREFUSED 127.0.0.1:80
It's not this, I change the Promise I have and worked, I don't know what the error is in Axios, but when I redeploy worked, the axios is right, this headers is custom there is no problem with my axios call, but thank you so much
77 replies
AxiosError: connect ECONNREFUSED 127.0.0.1:80
export default class LotteryApi {
getLottery = async (lottery) => {
try {
const { data } = await request.get('/resultado', {
params: {
loteria: lottery
}
});
return data;
} catch (error) {
console.error(error);
}
};
}
77 replies