The Fiber Gateway is a GoLang-based project designed to serve as a versatile gateway for various API management
-
Load Balancing: Distribute incoming requests evenly across multiple backend services to ensure optimal resource utilization and fault tolerance.
-
Rate Limiting: Protect services from excessive traffic by setting rate limits on incoming requests.
-
API Forwarding: Easily configure and manage the routing of API requests from clients to the appropriate backend services.
Before you can run the Fiber Gateway, ensure you have the following prerequisites installed:
- Go: Make sure you have Go installed on your system.
- Clone the repository to your local machine:
git clone git@github.com:khiem20tc/go-fiber-gorm-boilerplate.git- Create a
.envfile and define the necessary environment variables. These variables will be used for configuration. Example:
DATABASE_URL="localhost:5432"
- Download and install packages
go mod download && go mod tidy- Run the Fiber Gateway using the following command:
go run main.goor
nodemon --watch './**/*.go' --signal SIGTERM --exec 'go' run ./main.go- Run Lint-stage for Golang
golangci-lint run- Gen swagger API document using the following command:
go run ./scripts/gen-swagger/main.go && go run ./scripts/swag/main.go init --ot go,json --parseDependency true- Build docker container
docker-compose up -d --force-recreateOnce the Fiber Gateway is up and running, you can start sending API requests to it, and it will handle load balancing, rate limiting, and forwarding based on the configuration.