This project is a simple Go-based RESTful API built with the Gin Web Framework.
- RESTful API built with Go and Gin
- Demonstrates all CRUD operations
- Includes simple test suite for unit testing
- Dockerized application for easy deployment and scalability
Before getting started with this project, ensure you have the following dependencies installed:
To get started with this project, follow these steps:
-
Clone the repository:
git clone https://gitlab.com/devops-projects6943118/ci-cd/go-rest-api.git
-
Change into the project directory:
cd go-rest-api
-
Install the dependencies:
go mod download
-
Run the application:
-
Option 1: Run locally
go run main.go
-
Option 2: Run with Docker
-
Build the image locally:
docker build -t go-app .
-
Run the docker container
docker run -dp 3000:3000 go-app
-
-
-
You can now access the app at: http://localhost:3000/albums
-
To add am item to the list:
curl http://localhost:3000/albums \ --include \ --header "Content-Type: application/json" \ --request "POST" \ --data '{"id": "5","title": "The Modern Sound of Betty Carter","artist": "Betty Carter","price": 49.99}'