Golang API that returns Github user / stargazer usernames and repositories as well as follower repositories. Utilizes the go-github package to interface with the Github API
- NOTE 1: Port
8880
or the one specified indocker-compose.yml
andmain.go
must be available. - NOTE 2: On Windows 10 Pro or greater? You can use Chocolatey to install Docker CE for Windows and everything else listed below.
- Install Golang if you want to run the API on your host machine. If you wish to run the API in a Docker container, you can skip this step.
- Install Golang dependencies if you want to run the API on your host machine. If you wish to run the API in a Docker container, you can skip this step.
go get github.com/gorilla/context
go get github.com/gorilla/mux
go get github.com/google/go-github/github
go get golang.org/x/oauth2
go get golang.org/x/net/context/ctxhttp
- Install Docker and Docker Compose. If you wish to run the API on your host machine, you can skip this step.
-
Set the token as an environment variable named
TOKEN
- Windows:
$env:TOKEN="Github API TOKEN"
- Linux:
export TOKEN="Github API TOKEN"
-
To run on host system
-
go build main.go
-
./main
or.\main.exe
-
To run in a docker container
docker-compose up
- TYPE: GET
- Returns a list of 5 followers for the specified Github user as well as the followers of the followers 3 levels deep.
/followers/{:Github User}
- Example:
/followers/torvalds
- TYPE: GET
- Returns a list of 5 repositories for a specified Github user and a list of 5 stargazers for each repository. The lists go 3 levels deep.
/repos/{:Github User}
- Example:
/repos/torvalds
devel