A simple Golang http service that lists the top Github contributors given a location.
A simple Golang http service that lists the top Github contributors given a location.
Features included:
There is a Docker image called smoya/ghtop
. In order to run the service, just do:
docker run --publish 8080:8080 smoya/ghtop:latest -gh-token=<github token>
Ghtop requires Go 1.9 or later.
go get -u github.com/smoya/ghtop
Run the server:
ghtop -gh-token=<github token> -ttl=<ttl in seconds>
The GET /top
endpoint should be now mounted.
Curl http://localhost:8080/top?location=barcelona in order to see the top dev contributors in Barcelona area.
Replace barcelona
with whatever location you want to look at.
curl 'http://localhost:8080/top?location=barcelona'
If authentication is required, the application is ready for use Basic HTTP authentication rfc2617. In further versions JWT could be implemented.
In order to prompt the authentication dialog on the /top
endpoint, you must specify the user and password when running the service.
name | type | description | required | default |
---|---|---|---|---|
-port | int | Server's listening port | no | 8080 |
-env | string | Sets the environment. Just for logging. | no | prod |
-gh-token | string | Github personal access token. Create yours from https://github.com/settings/tokens/new | yes | |
-ttl | int | The ttl in seconds for the repository cache. | no | 300 |
-auth-user | string | The username for basic Http Authentication. No Auth if empty | no | |
-auth-password | string | The password for basic Http Authentication. | no |
Ghtop library tests are split in two:
Run make tests
and make e2e
respectively, or make check
in order to run all of them.
GET /top
request.