Skip to content

Commit

Permalink
add api hyphen function
Browse files Browse the repository at this point in the history
  • Loading branch information
haydnba committed Apr 19, 2018
2 parents 89e9fff + a6505c2 commit 95c8e63
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
25 changes: 20 additions & 5 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,25 @@ main {

.nav__container {
position: fixed;
display: block;
top: 0;
display: block;
top: 0;
height: 9vh;
background: white;
width: 100%;
}
.nav__list {
margin: 0px;
padding: 1vh;
}
.nav__link {
text-decoration: none;
}
.nav__link img {
height: 30px;
padding:1vh;
}


.nav__item {
}
.section__banner {
Expand All @@ -31,6 +43,8 @@ main {
.section__coins {
}
.coins__list {
background-color: white;
margin: 200px;
}
.coin__list--item {
}
Expand All @@ -40,7 +54,7 @@ main {
.coin-article {
background-color: lightGray;
width: 400px;
margin: auto;
margin: 9vh auto;
padding: 15px;
}

Expand Down Expand Up @@ -74,9 +88,10 @@ margin: auto;
.coin-article__footer {
background-color: gray;
}
/* .footer__container {}

/* .footer__container {}
.error {}
.error__desc {}
.error__desc {}
.error__msg {}
.error__image {}
Expand Down
6 changes: 5 additions & 1 deletion src/controllers/coin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ function appendApiData(url, callback) {
})
}

function addHyphen(thing) {
return thing.replace(' ', '-');
}

exports.get = (req, res, next) => {
const { coinSym } = req.params;
coinDetial(coinSym)
.then(coinRecord => {
if (coinRecord && coinRecord.length > 0) {
coinRecord = coinRecord[0];
appendApiData(`https://api.coinmarketcap.com/v1/ticker/${coinRecord.name}/?convert=GBP`, function(err, result) {
appendApiData(`https://api.coinmarketcap.com/v1/ticker/${addHyphen(coinRecord.name)}/?convert=GBP`, function(err, result) {
if (err) next();
else {
result = JSON.parse(result);
Expand Down
9 changes: 4 additions & 5 deletions src/views/home.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

<h1>The future is FACoin!!</h1>
<h3>And the future looks rich</h3>

</section>

<section class="section__coins">
<div class="section__coins">
<ul class="coins__list">

{{#each allCoins}}
Expand All @@ -18,7 +15,9 @@
</a>
</li>


{{/each}}

</ul>
</section>
</div>
</section>
4 changes: 2 additions & 2 deletions src/views/partials/navbar.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<nav class="nav__container">
<ul class="nav__list">
<a class="nav__link" href="/">
<li class="nav__item">HOME</li>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAKFSURBVGhD7dpLqE1RHMfx4xGSSArdzMgreSe37owSAxQllIwMGChKBgaSwlySkgwMrgFlYGLiLYoiMZRnIjJB3r6/0123f7v/Oufea+9z1tH61afuOfu1fneftc++59xaxVmBR9iFYXqi0zIeJ/Ebf/pcxXR0TFbhOUIB6zN2YziSzQSchj0LMTcxE8llDV7BG3TMF+zFCLQ9E3EW3kAH6g7moG1ZhzfwBmfdx8/Cc0VfsR8j0bJMwjl4A7I+YhuU5XgCbz3rHuah8mzAW3iDsC5iKmzG4Ah+wNsm+IYDqOTsTEYvvANb77EZjbIEepP0trceYAFKyya8g3cw6zxUeCAZhUP4Dm9fgZYfhNYfcqbgArwDWHqp6SU3lCyEfvPefq2HWIxBZys+wNuppUmvyf8v0VzQnNDc8I4RaG4dxmg0TRcuwduR9RprUWZ0tdJVyzue9RjLEM126JLpbWydgd4Iq4jOzj7ofcU7dqCzcwy6EvZnGi7D28B6idVoRWbjNrxxWE/RjXo+wVsp0E3gKeimsJXRHfIe6I7ZG1fwC7pouAsDnYWVaGdm4Ba88QU9cBcEJ5BCtsAbX/B/FtFcuG4eS6zILOhWwzMXZadY5C7090x43F/kGTQX9ERYKLEiN2DXs3QfVXaKRXTLr7lzre9xvchxjNMPpJOKKPpkRp/QLKo/Mum0ItHkIkYu0iC5SBArolv4HREbUXYqK9LqJFVkPfR3fTNekiqig9t9x3jJRYJcxEkuQnKRIBdxkouQXCTIRZzkIiQXCfRt0tGS6H9R7L5jvG2L39kMukiqmhaZD2/D1OxEw+g7iSvwNk7FC+iL2qZRmaXQZ8Gp0Ut/LAqp1f4CE2pxmSVOz6wAAAAASUVORK5CYII=">
</a>
</ul>
</nav>
</nav>

0 comments on commit 95c8e63

Please sign in to comment.