GO Simple Gateway is a lightweight gateway application written in Go that acts as an intermediary between multiple APIs with different domains. It allows you to configure the endpoints and namespaces for each API through a YAML configuration file. This project utilizes the Go Fiber library for building fast and efficient HTTP APIs.
- Acts as a gateway for multiple APIs with different domains.
- Configuration is stored in a YAML file.
- Implements middleware for handling requests.
- Supports various HTTP methods (GET, POST, PUT, PATCH, DELETE).
- Easy to configure and extend.
- Go 1.16 or above
- Go Fiber library (https://github.com/gofiber/fiber)
-
Clone the repository:
git clone https://github.com/your-username/go-simple-gateway.git
-
Change to the project directory:
cd go-simple-gateway
-
Build the project:
go build
-
Run the executable:
./go-simple-gateway The server will start running on http://localhost:8080.
The configuration for the gateway is stored in a YAML file named config.yml. Update this file according to your API endpoints and namespaces. Here's an example of the configuration file:
- endpoint: http://httpbin.org/
namespace: httpbin
In the above example, the gateway will forward requests with the /httpbin namespace to the http://httpbin.org/ endpoint.
To access the APIs through the gateway, use the following URL format:
http://localhost:8080/v1/{namespace}/{path}
Replace {namespace}
with the desired namespace from your configuration file and {path}
with the specific path for the API endpoint.
The gateway application includes a middleware that can be used for various purposes such as request logging, authentication, rate limiting, etc. Currently, the middleware is empty and can be customized according to your needs. Feel free to add your own logic and functionality to the middleware.
Contributions are welcome! If you find any issues or want to add new features to the project, please open an issue or submit a pull request.
This project is licensed under the MIT License.
- Go Fiber A fast and efficient web framework for Go.
If you have any questions or suggestions, feel free to reach out to me at [email protected]
Feel free to modify the README.md file according to your project's specific details and requirements. Provide instructions for setting up and running the application, describe the available features, and include any necessary guidelines for contributing to the project.