Created
August 25, 2017 18:56
-
-
Save orthros/3b9e1ee333f881c30b3b4b225ed87833 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const client = new stitch.StitchClient(APP_ID); | |
const db = client.service('mongodb', 'mongodb-atlas') | |
.db(APP_DB); | |
function displayIssuesOnLoad() { | |
client.authenticate('apiKey', APP_API_KEY) | |
.then(displayIssues); | |
} | |
function displayIssues() { | |
db.collection(APP_COLLECTION) | |
.find({ }, { limit: 10 }) | |
.then(docs => { | |
console.log(docs); | |
var html = docs.map(c => `<div class="center-block"> | |
<hr> | |
<div class="center-block text-center">Issue: <a href="${c.issue.issue.html_url}">${c.issue.issue.title}</a></div> | |
<div class="text-center">Comments: ${c.issue.issue.comments}</div> | |
<div class="text-center"> | |
Repository: | |
<a href="${c.issue.repository.html_url}">${c.issue.repository.name}</a> | |
</div> | |
<hr> | |
</div>`) | |
.join(""); | |
document.getElementById("issues").innerHTML = html; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment