Created
August 25, 2016 21:49
-
-
Save rotemtam/49afbb9cf31de8370a82d624960ec9a2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
'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