Api-go-gin-viper - Simple representaion on how to implement CRUD functionality in API using Go programming language

Simple API implementaion in Go

To Get Started

Clone repo

Run the command to clone this github repository and change the directory to the project's folder:

git clone https://github.com/vsevdrob/api-go-gin-viper.git && cd api-go-gin-viper/src

Before run some commands, download some Go dependencies first.

This will download one of the coolest HTTP web framework written in Go (Golang).

go get github.com/gin-gonic/gin

Viper helps us to to operate with the predefined config.yaml file in order to export some required values from it.

go get github.com/spf13/viper

Usage

Start server

Run the command that starts the server on host 127.0.0.1 and port 8080.

go run main.go

After that open another terminal window and insure the path of current working directory is */api-go-gin-viper/src/


Add funder

Adds a funder to the DB. Assuming that address and amount keys/values in single_funder.json are predefined by Frontend.

curl localhost:8080/add-funder --header "Content-Type: application json" -d @single_funder.json --request "POST"

Add funders

Adds a list of funders one by one to the DB. The same keys/values from above are also predefined in numerous_funders.json.

curl localhost:8080/add-funders --header "Content-Type: application json" -d @numerous_funders.json --request "POST"

Fetch funder

Get a funder's data by assiging his/her id in the query.

curl localhost:8080/fetch-funder?id=1 --request "GET"

Fetch funders

Get a list of each funder's data from the DB.

curl localhost:8080/fetch-funders --request "GET"

Update funder

Update funder's funded total amount by increasing it. Assign the id in the query to update a specific funder.

curl localhost:8080/update-funder?id=1 --request "PATCH"

Delete funder

Delete a funder from DB. Assign funder's id in the query to delete the prefered one.

curl localhost:8080/delete-funder?id=1 --request "DELETE"

Licence

MIT

Owner
Vsevolod Drobyshev
Eng/Ned/рус/简体中文 Junior Full-Stack Web3 Developer.
Vsevolod Drobyshev
Similar Resources

Demo application to implement a REST api backend service for an android app using the Go aah framework.

aah-recycleview-backend This tutorial is based on the aah framework to implement a REST API form of CRUD application services, taking "IN-MEMORY" stor

Jan 28, 2022

A URL shortener using http://is.gd/ and the Go programming language (http://golang.org/)

goisgd A simple command line URL shortener using http://is.gd/. Getting the Code go get github.com/NickPresta/GoURLShortener Usage Import this librar

Apr 6, 2022

Simple vanilla Go CRUD application with mongoDB database with its mflix dataset that I use for my thesis about benchmarking REST API and GraphQL.

Go GraphQL Simple vanilla Go CRUD application with mongoDB database with its mflix dataset that I use for my thesis about benchmarking REST API and Gr

Oct 15, 2021

A checkout functionality for an ecommerce application

A checkout functionality for an ecommerce application

EcommerceApp Server A checkout functionality for an ecommerce application 📖 Made with Golang 🚀 Installation and execution | Available Routes | How t

Nov 23, 2021

Simple web app using Go and Gin framework

go-gin-app Simple web app using Go and Gin framework Golang 과 Gin 프레임워크를 사용한 간단한 웹 앱 How to get Started Install Gin and have Go installed on your syst

Oct 18, 2021

A simple database application that I was asked to implement as part of a job application process

This is a simple database application that I was asked to implement as part of a job application process. They told me I could choose any languages an

Nov 24, 2021

A simple CRUD todo list application that is powered by Docker and Go

A simple CRUD todo list application that is powered by Docker and Go. Docker compose will run two containers todolist and mysql.

Jan 18, 2022

Restful API example with using go and gin framework

simple device api Simple Device API is really simple and concise to show how easy to implement a Restful Service with using Golang. It uses gin framew

Nov 18, 2021

GO API with Gin Gonic with postgresql using gorp

GO API with Gin Gonic with postgresql using gorp Tips: Make sure you have project in src folder of $GOPATH Also, iniitalize go mod init project-name a

Jul 28, 2022
GinGoExample - Implement rest api using gin and go and mongodb

GinGoExample Implement rest api using gin and go and mongodb Optimizations using Singlton pattern to avoid repetetive commiunication with mongodb . Fe

Mar 25, 2022
Go-gin-mongo-api - A backend RESTful API built using golang, gin and mongoDB

go-gin-mongo-API This is a RESTful backend API which is developed using the gola

Jul 19, 2022
Build a TodoList with Go Design and implement a backend RESTful service in golang with CRUD

May we ask Igor to do a little project in leu of sample code? If there is a hire, the hours spent should be invoiced, so please keep track of that. Th

May 5, 2022
Go-service-gin - Simple Web api application developed in Golang and Gin

Simple Web api application developed in Golang and Gin Initial Tutorial URL http

Jan 4, 2022
Gin-boilerplate - This repository contains boilerplate code of a REST service using Gin (golang) framework.

Boilerplate REST service using Gin web framework (golang) Introduction This repository contains a boilerplate REST API service using Gin web framework

Apr 28, 2022
Go (Golang) API REST with Gin FrameworkGo (Golang) API REST with Gin Framework

go-rest-api-aml-service Go (Golang) API REST with Gin Framework 1. Project Description Build REST APIs to support AML service with the support of exte

Nov 21, 2021
Golang Gin Framework CRUD RestAPI with MySQL for music records.

web-service-gin Golang Gin Framework CRUD RestAPI with MySQL for music records. Installation This application runs on Go version 1.18.1. You can insta

Oct 17, 2022
Gin-easy-todo - golang 의 RESTful API 프레임워크 gin 을 활용해 아주 간단한 Todo 애플리케이션을 만들어보자.
Gin-easy-todo - golang 의 RESTful API 프레임워크 gin 을 활용해 아주 간단한 Todo 애플리케이션을 만들어보자.

목차 1. 요약 2. 목표 3. API 목록 4. 프로젝트 구조 5. 패키지 별 기능과 관계 6. 사전 작업 6.1. DB, Table 생성 6.2. 모듈 생성 6.3. 패키지 다운로드 7. Gin 작성 7.1. 데이터베이스 설정 7.2. 테이블, 스키마 정의 7.3.

Jan 2, 2022
Go-gin-ddd-cqrs - Clean api rest with Go, Gin and GORM
Go-gin-ddd-cqrs - Clean api rest with Go, Gin and GORM

GOLANG API REST Clean api rest with Go, Gin and GORM. Clean Architecture with DD

Oct 21, 2022
Gin-boilerplate - Gin boilerplate preconfigured with basic rest api features

Gin Boilerplate Build apis with gin faster with this template Features Validatio

Jun 24, 2022