api-gateway

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 5 Imported by: 0

README ΒΆ

πŸš€ 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! πŸ˜‰

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL