This repository contains the backend code which fetches the public github repositories of a user/orgnization and its commits and stores it in a datastore. It also caches the github api results for upto 60 seconds before being invalidated.
- go
- docker-compose
The make file contains all the commands needed to build/run/mock/test the application. Some commands which are not so obvious:
-
make compose
- one command to rule it all. Build and run the application. Spins up the application and the database server. -
make mock
- (re)generate the mocks required for testing.
/user/:username/repositories
- Fetches the public repositories of a user. Optionally query paramaterspage
andperpage
can be supplied to paginate results. Please note that the paginations works properly only whencache
is empty. e.g. - http://localhost:8000/user/karthikraobr/repositories/user/:username/repository/:repository/commits
- Fetches the commits of a particular repository. Optionally query paramaterspage
andperpage
can be supplied to paginate results. Since this endpoint does not use a cache or a datastore, the pagination works all the time. e.g. - http://localhost:8000/user/karthikraobr/repository/gqlgen/commits/user/:username/top20
- Fetches Top 20 recently accessed repositories based on thelast_access
column.
- Frontend
- Caching/Fetching from the datastore does not paginate the results. Due to time constraints I could not add pagination during these scenarios.
package Store
does not contain tests.CI
could have been better.
- First time
gin-gonic
andgorm
user, hence best practices might have taken a backseat.