The API Gateway serves as a centralized entry point that routes requests to multiple backend services. It includes middleware for logging, authentication, and rate limiting to enhance security and performance.
- Go installed on your local machine
- Docker and Docker Compose (optional for containerized deployment)
- Clone the repository:
git clone <repository-url>
cd api-gateway
- Initialize Go modules and run services:
go mod tidy
go run main.go
go run service1.go
go run service2.go
docker-compose up --build
- Logging: Records incoming requests for debugging and analysis.
- Authentication: Verifies tokens to secure access to backend services.
- Rate Limiting: Controls the rate of requests to prevent abuse and ensure service availability.
- Service 1 on http://localhost:8001
- Service 2 on http://localhost:8002
- /service1 proxies to http://localhost:8001
- /service2 proxies to http://localhost:8002