Skip to content

Instantly share code, notes, and snippets.

@rotemtam
Created August 25, 2016 21:49
Show Gist options
  • Save rotemtam/49afbb9cf31de8370a82d624960ec9a2 to your computer and use it in GitHub Desktop.
Save rotemtam/49afbb9cf31de8370a82d624960ec9a2 to your computer and use it in GitHub Desktop.
'use strict';
const request = require('axios');
function *search(query) {
let options = {
params: {
q: query,
sort: 'stars',
order: 'desc'
},
headers: {
'User-Agent': 'rotemtam'
},
responseType: 'json'
};
let res = yield request.get('https://api.github.com/search/repositories', options);
return {items: res.data.items};
}
module.exports = {
search: search
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment