-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
66 lines (53 loc) · 2.06 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html>
<head>
<title>CoinMarketCap</title>
<link rel="stylesheet" type="text/css"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<meta charset="utf-8">
</head>
<body>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item active" aria-current="page">Coin Market Cap</li>
</ol>
</nav>
<div class="d-flex p-3 bd-highlight">
<div id='coins'></div>
</div>
<script type="text/javascript">
//My api key
var apikey = {
key: 'MINHA CHAVE AQUI!!!!'
}
//GET Fetch Requisition
fetch('https://pro-api.coinmarketcap.com/v1/cryptocurrency/map?CMC_PRO_API_KEY=' +
apikey.key)
.then((response) => {
if(!response.ok) throw new Error('Erro ao executar a requisição, status ' + response.status);
return response.json();
})
.then((api) => {
var texto = "";
// Get 10 coins and symbols
for(let i = 0; i < 10; i++){
//Show API information
texto = texto + `
<div class="media">
<img src="btc.jpg" class="align-self-center mr-3" alt="coin" width="150" height="100">
<div class="media-body">
<h5 class="mt-2">${api.data[i].name}</h5>
<p>${api.data[i].symbol}</p>
<p>${api.data[i].first_historical_data}</p>
</div>
</div>
`;
document.getElementById("coins").innerHTML = texto;
}
})
.catch((error) => {
console.error(error.message);
});
</script>
</body>
</html>