const axios = require('axios');
const COC_API_URL = 'https://api.clashofclans.com/v1';
const API_TOKEN = '.-_-z__D54H4A';
async function connectToCOC_API() {
try {
const response = await axios.get(`${COC_API_URL}/player/#LGV28Q2Y9`, {
headers: {
'Authorization': `Bearer ${API_TOKEN}`
}
});
console.log('Erfolgreich mit der Clash of Clans API verbunden.');
return response.data; // Rückgabe der Daten von der API für weitere Verarbeitung
} catch (error) {
console.error('Die Verbindung zur Clash of Clans API ist fehlgeschlagen:', error);
throw error;
}
}
module.exports = connectToCOC_API;
And yes I add my token in a .evn but just for the test I do it like this it's in a discordserver with only me as member it's save 🙂 no worry
But my main prob is that normaly the console should log con successful or not and the error.
But nothing happend😌 someone have a Idea why
