repository
0.0.0-20241114134857-fe03b4b32279
Repository: https://github.com/allanm007/simpler-test.git
Documentation: pkg.go.dev
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# README
Backend Engineer Take Home Test @Simpler
- This is a simple CRUD REST API written in Go for a product resource microservice built using golang(gin,gorm) and using postgres as a database.
Prerequisites
- Go 1.21+
- Docker
- Docker Compose
Installation
- Clone the repository
git clone https://github.com/AllanM007/simpler-test
- Navigate to the directory
cd simpler-test
- Build and run the Docker containers
docker compose up -d
API Documentation
- This API is documented using Swagger and can be accessed at:
http://localhost:8080/api/swagger/index.html
Pagination
- This API utilizes Offset api pagination in the products endpoint by passing page=?&limit=? parameters to the
products
endpoint.
Tests
- The project has unit and integration tests utilizing testcontainers which can be run using:
go test -v ./...
Endpoints
POST /api/v1/products
: Create a new product.GET /api/v1/products
: Get all products.GET /api/v1/products/:id
: Get a single product.PUT /api/v1/products/:id
: Update a product.DELETE /api/v1/products/:id
: Delete a product.PUT /api/v1/products/:id/sale
: Product Sale.
CI/CD
- This API has a ci/cd pipeline implemented using GitHub Actions that builds, tests and deploys the service to a container registry: Docker Hub .