- This is a microserver that responds to
GET /api/languages
requests, with a json string that represents the languages that are used by the first 100 trending public repositories on Github. For each language, it provides the number and also the list of repos that are using it, as described below. - The rendered json string contains 2 properties :
"total_count"
: represents the total number of distinguished languages used by the 100 repos."items"
: is an json array of json language objects, each of which has three nested properties:"language"
: is the language name."repos_count"
: is the total number of repos, among the 100,"language"
property of which is the same as the language name."repos"
: is a json array of containing all those repos using that same language.
{"total_count":32,"items":
[{"language":"Python","repos_count":17,"repos":
[{"id":319029846,"node_id":"MDEwOlJlcG9zaXRvcnkzMTkwMjk4NDY=","name":"Depix", "full_name":"beurtschipper/Depix","private":false,"owner":{"login":"beurtschipper","id":4620457,"node_id":"MDQ6VXNlcjQ2MjA0NTc=","avatar_url":"https://avatars0.githubusercontent.com/u/4620457?v=4",
...
- NodeJS
- NPM
- ExpressJs (only dependency)
- PORT is defaulted to 5000.
- OAuth TOKEN is used to increase github API requests limit to 30req/min.
You can change both of these configuration parameters in both files of the /config/
directory.
- run
$ npm install --production
to install dependencies (while ignoring devDependencies) - run
$ npm run start
to start the server in production mode (the main file ismicroserver.js
)
- Repos with a
"language"
value equal tonull
are also listed - In regards to the languages variousness that a single github repository may have, this microserver
only takes into consideration the main one language each github repository is using. For, it doesn't
use the
"languages_url"
property of a json github repo.
"language": "HTML",
"languages_url": "https://api.github.com/repos/LeonidasEsteban/reto-netflix/languages"
{
"HTML": 8899,
"CSS": 3962
}
Thus, in the CSS language element listed in "items"
json array, which could be rendered by this microservice, you won't find listed this repo.
- No client authentification is required
- No custom error handler is used for: github API fetching, client faulty requests or internal errors.