Added artist information on last.fm example with bio, tags, cover image, and stats

This commit is contained in:
Sahat Yalkabov
2013-12-09 23:11:41 -05:00
parent e8f2a6688b
commit c5d2513e43
3 changed files with 49 additions and 21 deletions

View File

@ -174,6 +174,10 @@ exports.getEtsy = function(req, res) {
*/
exports.getNewYorkTimes = function(req, res) {
res.render('api/nyt', {
title: 'New York Times API',
});
};
/**
@ -186,10 +190,34 @@ exports.getLastfm = function(req, res) {
secret: '4ae76d10d76cf680cebf4f0c8dea1aa4'
});
res.render('api/lastfm', {
title: 'Last.fm API',
lastfm.request("artist.getInfo", {
artist: 'Epica',
handlers: {
success: function(data) {
console.log(data);
var artist = {
name: data.artist.name,
image: data.artist.image.slice(-1)[0]['#text'],
tags: data.artist.tags.tag,
bio: data.artist.bio.summary,
stats: data.artist.stats
};
res.render('api/lastfm', {
title: 'Last.fm API',
artist: artist
});
//return res.send(data.artist);
},
error: function(error) {
console.log(error.message);
return error.message;
}
}
});
};
/**