Provides an HTTP server proxying to github to search the top rated repositories. The code tries to avoid smells, be clean, SOLID and use some common design patterns. The queries to github are cached, so the second time they are called github is not reached. To avoid just responding what github provides, the response is converted before sending it back to the requester.
It receivs the following parameters in the query string:
- page (number; default = 1)
- count (number: default = 10 or the value provided in the env var: DEFAULT_COUNT_PER_PAGE)
- language: (string; optional) display repositories only for that language
- createdFrom: (string; optional; format: yyyy-mm-dd) display repositories created from the given date
- PORT (number, default: 8080) sets the http port where the server listens
- DEFAULT_COUNT_PER_PAGE (number, default: 10) sets the default count per page to display in the response
There are some unit tests as an example of how the streams can be tested. Also there's one integration test.
There's still the need to add automated acceptance test by mocking the calls to github.
npm i && npm run serve
Then execute a request (there's no specific endpoint):
http://localhost:8080/?language=php&page=1&count=50&createdFrom=2022-01-01
npm run tests