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

Overview

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

You might also like...
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

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

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

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

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

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

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.

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

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

Owner
Vsevolod Drobyshev
Eng/Ned/ั€ัƒั/็ฎ€ไฝ“ไธญๆ–‡ Junior Full-Stack Web3 Developer.
Vsevolod Drobyshev
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

Mehdi 0 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

Humbe Jeffrey 6 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

Igor 2 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

Nurul Huda Robin 0 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

null 6 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

Tony Aizize 1 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

jpaola 5 Oct 17, 2022
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.

jongbae_park 0 Jan 2, 2022
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

Juan Cantรณn Rodrรญguez 17 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

Mohan barman 4 Jun 24, 2022