# README
š Orders Microservice in GoLang
Overview
Welcome to the Orders Microservice! This project is a RESTful API built with GoLang, designed to handle CRUD operations for orders and items. The service is engineered for high performance, leveraging Go-Chi for efficient routing and Redis for fast data storage. Deployment is containerized using Docker, ensuring seamless cross-platform compatibility.
Features
- š RESTful API: Perform Create, Read, Update, and Delete operations on orders and items with clean, intuitive endpoints.
- āļø Go-Chi Router: Optimized routing for handling HTTP requests efficiently.
- š¦ Redis Integration: Utilized as the primary data store with custom environment configurations for flexibility.
- š³ Dockerized: The entire service runs smoothly in Docker containers, supporting cross-platform deployment.
Project Structure
āāā cmd/
ā āāā main.go # Entry point of the service
āāā pkg/
ā āāā orders/ # Order-related operations
ā āāā items/ # Item-related operations
ā āāā router/ # API routing logic using Go-Chi
āāā config/
ā āāā config.go # Configuration settings for Redis and other environments
āāā Dockerfile # Docker setup for containerizing the service
āāā go.mod # Go module dependencies
āāā README.md # Project documentation
Getting Started
Prerequisites
Installation
-
Clone the repository:
git clone https://github.com/yourusername/orders-microservice.git cd orders-microservice
-
Build the Docker image:
docker build -t orders-microservice .
-
Run the Docker container:
docker run -d -p 8080:8080 --name orders-service orders-microservice
-
Access the service: Open your browser or use Postman to access the API at
http://localhost:8080
.
Configuration
Configure the Redis server address and port in the config/config.go
file:
RedisAddress = "localhost:6379"
RedisPassword = ""
API Endpoints
GET /orders
- Retrieve all ordersPOST /orders
- Create a new orderGET /orders/{id}
- Retrieve a specific orderPUT /orders/{id}
- Update an existing orderDELETE /orders/{id}
- Delete an order
Deployment
Deploying this service is as easy as running it in a Docker container. The provided Dockerfile ensures that all dependencies are installed, and the service is ready to run on any platform that supports Docker.
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests for improvements and new features.
License
This project is licensed under the MIT License - see the LICENSE file for details.