Skip to content

edlorenzo/users-api

Repository files navigation

Simple blog system

users-api

Simple Github User API Ready Prod.

Quick start

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.

Getting started

Install Golang (go1.17+)

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

Initialize Swagger Docs

go install github.com/swaggo/swag/cmd/swag@latest
make swagger-init

Working with makefile

make help

Install dependencies

➜ go mod download
➜ make tidy

Run

➜ go run main.go

Build

➜ go build

Tests

➜ make test

Swagger UI

Access the application using the port 5007. Open url http://localhost:5007/swagger/index.html in browser.

Swagger Result

Another Redis Desktop Manager

Visualizing data stored from Redis using Another Redis Desktop Manager.

Redis Result

List of technology used:

Solutions and Integration Section

  • 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.

About

Github Users API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published