Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.