https://github.com/verma-kunal/go-rest-api
Simple REST API with Go and Gin Web Framework
https://github.com/verma-kunal/go-rest-api
gin-framework golang rest-api
Last synced: 5 months ago
JSON representation
Simple REST API with Go and Gin Web Framework
- Host: GitHub
- URL: https://github.com/verma-kunal/go-rest-api
- Owner: verma-kunal
- License: mit
- Created: 2023-04-27T09:48:20.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-14T13:53:22.000Z (about 3 years ago)
- Last Synced: 2025-02-16T20:15:04.840Z (over 1 year ago)
- Topics: gin-framework, golang, rest-api
- Language: Go
- Homepage:
- Size: 99.6 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go REST API with Gin
## Introduction
This project is a simple **Go-based RESTful API** built with the [Gin Web Framework](https://gin-gonic.com/docs/quickstart/).
## Features
* 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
## Prerequisites
Before getting started with this project, ensure you have the following dependencies installed:
- [Go (version 1.16+)](https://go.dev/doc/install)
- [Docker](https://www.docker.com/)
## Getting Started
### Setup the Project
To get started with this project, follow these steps:
1. **Clone the repository:**
```
git clone https://gitlab.com/devops-projects6943118/ci-cd/go-rest-api.git
```
2. **Change into the project directory:**
```
cd go-rest-api
```
3. **Install the dependencies:**
```
go mod download
```
4. **Run the application:**
- **Option 1: Run locally**
```
go run main.go
```
- **Option 2: Run with Docker**
1. Build the image locally:
```
docker build -t go-app .
```
2. 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}'
```