A basic REST API implementing crud functionalities with MySQL.

go-crud-app

A CRUD REST API with mysql
Uses:

  • gorilla/mux
  • gorm

Implemented

  • [] GET /book returns list of books as JSON
  • [] GET /book/{id} returns details of a specific book as JSON
  • [] POST /book accepts a new book to be added
  • [] POST /book returns status 415 if content is not application/json

Data types

A book object should look like this:

{
    "id": 3,
    "title": "Karnali Blues",
    "author": "Buddhi Sagar",
    "publication": "XYZ"
}

Persistence

MYSQL database is used. Configure mysql database credentials by editing .../pkg/config/app.go

// Database credentials
var (
	username = "root"
	password = "password"
	db       = "crud_app"
)

Setup

go get "github.com/gorilla/mux"

go get 	"github.com/jinzhu/gorm"

go get "github.com/jinzhu/gorm/dialects/mysql"

go run cmd/main/main.go
Owner
Roshan Lamichhane
A mediocre computer engineering student.
Roshan Lamichhane
Similar Resources

A very basic cli keyring tool to use accross various OS.

A very basic cli keyring tool to use accross various OS.

Dec 14, 2022

basic terminal based chat application written in go

basic terminal based chat application written in go

this app uses websocket protocol to communicate in real time. both the client and the server are written in golang. it uses: gorilla/websocket package

Nov 4, 2021

Scrappy is a cli tool that allows multiple web scrappers to monitor periodically for a basic ruleset coverage and inform users when the criteria have been met.

Scrappy - A multi-type web scrapper with alerting Scrappy is a cli tool that allows multiple web scrappers to monitor periodically for a basic ruleset

Nov 7, 2021

Basic timestamped console printing.

loglines Basic timestamped console printing. What This is a very simple package with three functions: NowString() returns a string with the current ti

Nov 20, 2021

A template and a functioning example for a basic JFrog CLI plugin

hello-frog About this plugin This plugin is a template and a functioning example for a basic JFrog CLI plugin. This README shows the expected structur

Nov 26, 2021

Basic CLI save editor for Medieival Dynasty written in Go.

Basic CLI save editor for Medieival Dynasty written in Go.

Medieival-Dynasty-save-editor Basic CLI save editor for Medieival Dynasty written in Go. Windows binaries Usage Backup your saves first. Made for GOG

Apr 12, 2022

Basic usage of Vecty framework examples.

vecty-examples Basic usage of Vecty framework examples. Instructions Change directory to the folder with the example you wish to run Run wasmserve. To

Jun 20, 2022

A few serve, the rest enjoy the free drinks

Tavern A few serve, the rest enjoy the free drinks. ⚠️ Work in progress, experimental As the Tavern client downloads, decrypts and publishes to the wo

Jul 29, 2022

Simple to do list API with Gin and Gorm (with Postgres)Simple to do list API with Gin and Gorm (with Postgres)

go-todo Simple to do list API with Gin and Gorm (with Postgres) Docker Clone this repository and run: docker-compose up You can then hit the followin

Aug 29, 2022
Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

Description pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. pflag is compatible with the GNU extensions to

Dec 30, 2022
Simple CLI using spf13/cobra and Flink REST API

Flinkctl Flinkctl is a simple CLI written on Go using Cobra created to facilitate my team's daily basis work with multiple Flink clusters at Azion Tec

Aug 16, 2022
Boss-Stock Fiber (Go) and MongoDB REST API

Boss-Stock Fiber (Go) and MongoDB REST API An API built with Fiber and MongoDB. Installation go mod init go get -u github.com/gofiber/fiber/v2 go get

Apr 25, 2022
Todos REST API build using echo server.

Todos REST API build using echo server.

Feb 2, 2022
Simple todo app web application created with Go and MySQL.

TodoApp This is a project I've always wanted to do, it's simple, but to be says it involves to use different techniques in order to have a: authentica

Dec 21, 2021
A really basic thread-safe progress bar for Golang applications
A really basic thread-safe progress bar for Golang applications

progressbar A very simple thread-safe progress bar which should work on every OS without problems. I needed a progressbar for croc and everything I tr

Jan 1, 2023
Basic command line example using golang grpc client tools

This is a basic command line interface that demonstrates using the golang GRPC API. The API is reused between dishy and the wifi router, however both

Jan 3, 2023
a python command-line tool which draws basic graphs in the terminal
a python command-line tool which draws basic graphs in the terminal

Termgraph A command-line tool that draws basic graphs in the terminal, written in Python. Graph types supported: Bar Graphs Color charts Multi-variabl

Dec 30, 2022
A Go package for drawing basic graphics in a terminal

Tgraph Tgraph is a Go package for drawing basic graphics in a terminal. It was inspired by termgraph. Graph types supported: Bar Graphs Multi-variable

Nov 14, 2022
A template and a functioning example for a basic JFrog CLI plugin

hello-frog About this plugin This plugin is a template and a functioning example for a basic JFrog CLI plugin. This README shows the expected structur

Dec 21, 2021