traverson
Version:
Hypermedia API/HATEOAS client for Node.js and the browser
34 lines (31 loc) • 886 B
HTML
<html>
<head>
<meta charset="utf-8">
<title>Traverson in the Browser</title>
<script src="http://code.jquery.com/jquery-2.0.2.min.js"></script>
<script src="../dist/traverson.min.js"></script>
</head>
<body>
<p>
Talking to GitHub API, please stand by...
<p>
<p id="response"><p>
<script>
traverson
.from('https://api.github.com/')
.follow('repository_url', 'commits_url', 'comments_url')
.withTemplateParameters({
owner: 'traverson',
repo: 'traverson',
sha: '5c82c74583ee67eae727466179dd66c91592dd4a'
}).getResource(function(err, resource) {
if (err) {
$('#response').html(JSON.stringify(err))
return
}
$('#response').html('Hooray! The commit comment is <br/>"' +
resource[0].body + '"')
});
</script>
</body>
</html>