Simple Github User API Ready Prod.
Quick start you must install docker, docker-compose, Git and Fiber-Swagger.
Create new docker network
➜ sudo make network-prune
➜ sudo make network
Builds and tests
git clone https://github.com/edlorenzo/users-api.git
cd users-api
chmod o+w ./tests/postman
sudo chmod a+x start.sh
sudo ./start.sh
Press Ctrl + c
to stop application.
Please check the official golang installation guide before you start. Official Documentation Also make sure you have installed go1.17+ version.
For more info and detailed instructions please check this guide: Setting GOPATH
go install github.com/swaggo/swag/cmd/swag@latest
make swagger-init
make help
➜ go mod download
➜ make tidy
➜ go run main.go
➜ go build
➜ make test
Access the application using the port 5007
.
Open url http://localhost:5007/swagger/index.html in browser.
Visualizing data stored from Redis using Another Redis Desktop Manager.
- Golang - Go Programming Language.
- Fiber - Go Web Framework.
- Redis - A Redis Client for Go.
- Fiber-Swagger - Swagger for Fiber framework.
- docker - Docker
- docker-compose - Docker Compose
- Git - Git
- newman-docker - API automation test.
- Response data is sorted by name in ascending order.
sort.Slice(r.User.Data[:], func(i, j int) bool {
return r.User.Data[i].Name < r.User.Data[j].Name
})
- Iteration can be resumed if some usernames cannot be found.
- Caching feature to store user data in 2 minutes. If user's information has been cached, it should NOT hit Github again to retrieve the same user, instead it should return the user from the cache.
- Logrus integration for good error handling and logs.
- Added Http network feature to validate incoming http request.
- Only used pure http to call Github user api.
- Integration of swagger api documentation.
- Redis data store and data fetch, using serialize and deserialization approach to meet proper storing of data as redis only allowed flat data storing.