Skip to content

rakarmp/api-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 API Gateway with Gin

Welcome to the awesome API Gateway project using the Gin framework in Go! 🎉

✨ Key Features

  • 🧭 Smart routing to the right microservices
  • 🔐 JWT Authentication for maximum security
  • 🚦 Rate Limiting to keep the server stable
  • 📝 Advanced logging for monitoring
  • ⚙️ Flexible configuration management

🛠 Prerequisites

Before you start, make sure you have:

  • 🐹 Go - Latest Version
  • 🐳 Docker (optional, for containerization)

🏗 Installation

Follow these steps to get started:

  1. 📥 Clone this repository:
git clone https://github.com/yourusername/api-gateway.git

cd api-gateway
  1. 📦 Install dependencies:
go mod tidy
  1. 📄 Create a config.yaml file in the project root or config/ directory with your configuration settings.

⚙️ Configuration

Your config.yaml file should contain:

server_address: ":8080"
jwt_secret: "SERCRET_KEY_HERE"
rate_limit: 100
services:
users: "http://users-service:8081"
products: "http://products-service:8082"
orders: "http://orders-service:8083"

Adjust these values to match your setup! 😉

🚀 Usage

To run the API Gateway:

go run main.go

The server will start at the address you specified in the config file. Happy experimenting! 🎊

🛣 API Endpoints

The API Gateway will forward requests to the appropriate microservice based on the URL path:

👤 /api/users/*: Forwarded to Users service
🛍 /api/products/*: Forwarded to Products service
📦 /api/orders/*: Forwarded to Orders service

Remember, all requests require a valid JWT token in the Authorization header! 🔑

📜 License

This project is licensed under the MIT License. Feel free to use it, but don't forget to give stars! 😉

About

API-Gateway Using Gin Framework - Experimental

Topics

Resources

License

Stars

Watchers

Forks

Languages