Skip to content

daniwebdev/go-simple-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GO Simple Gateway

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.

Features

  • 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.

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/go-simple-gateway.git
    
  2. Change to the project directory:

    cd go-simple-gateway
    
  3. Build the project:

    go build
    
  4. Run the executable:

    ./go-simple-gateway
    
    The server will start running on http://localhost:8080.
    

Configuration

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.

Usage

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.

Middleware

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.

Contributing

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.

License

This project is licensed under the MIT License.

Acknowledgments

  • Go Fiber A fast and efficient web framework for Go.

Contact

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.

About

Simple API Gateway written in Go

Resources

Stars

Watchers

Forks

Releases

No releases published