Go-fiber - Implement CRUD Data Go and Mysql using Authentication & Authorization

Overview

Implement CRUD Data Go and Mysql using Authentication & Authorization

Microservices with Go using fiber Framework. The code implementation was inspired by port and adapter pattern or known as hexagonal: The hexagonal architecture is based on three principles and techniques:

  • Explicitly separate User-Side, Business Logic, and Server-Side
  • Dependencies are going from User-Side and Server-Side to the Business Logic
  • We isolate the boundaries by using Ports and Adapters

Data initialization

To describe about how port and adapter interaction, this example will have databases supported. There are MySQL using gorm as library.

How To Consume The API

//Exoprt DDL sql file first

//Example public endpoint
//JSON Example payload to register user
{
	"email": "[email protected]",
	"password": "12345",
    "level": 1
}

POST Method "http://localhost:8000/login" //to access endpoint register

//JSON Example payload to Login.
//this is user dengan credential
{
		"email": "[email protected]",
		"password": "12345"
}

POST Method "http://localhost:8000/login" 
//to access endpoint login
//also attach the token that has been generated

//Example private endpoint with Authentication
//to endpoint diary, also attach the token that has been generated when access endpoint login
GET    Method "http://localhost:8000/api/diary", to get all diary
GET    Method "http://localhost:8000/api/diary/1", to get diary by id
PUT    Method "http://localhost:8000/api/diary/1", to update diary by id
DELETE Method "http://localhost:8000//api/diary/1", to delete user by id

POST   Method "http://localhost:8000/api/diary", to create new diary
//this is Example payload to crete diary
{
	"title": "Golang",
	"body": "Belajar Pemrograman Golang"
}

Unit Testing

Unit testing with testify library

Owner
Stevra Silvanus
Back-end Developer | flutter enthusiast
Stevra Silvanus
Golang restAPI crud project with mySql database.

Golang RestAPI using gorilla/mux Golang restAPI crud project with mySql database. Test Api with Thunder Client vs code beautiful Extension. and use Be

Md Abu. Raihan 6 Mar 26, 2022
Приложение представляет собой API на языке Golang с функциями CRUD для MySQL.

golang-crud-mysql Приложение представляет собой API на языке Golang с функциями CRUD для MySQL. Также реализован UI при помощи HTML5, CSS3, немного JQ

Emil 0 Jan 18, 2022
mysql to mysql 轻量级多线程的库表数据同步

goMysqlSync golang mysql to mysql 轻量级多线程库表级数据同步 测试运行 设置当前binlog位置并且开始运行 go run main.go -position mysql-bin.000001 1 1619431429 查询当前binlog位置,参数n为秒数,查询结

null 13 Jun 14, 2022
An easy to use web authorization system integrated with MongoDB.

goth An easy to use web authorization system for MongoDB. Written 100% in Golang! Contributing Feel free to add an issue, and if you have a fix, creat

DaCool1 1 Feb 22, 2022
Sync MySQL data into elasticsearch

go-mysql-elasticsearch is a service syncing your MySQL data into Elasticsearch automatically. It uses mysqldump to fetch the origin data at first, the

siddontang 3.8k Aug 5, 2022
db-recovery is a tool for recovering MySQL data.

db-recovery is a tool for recovering MySQL data. It is used in scenarios where the database has no backup or binlog. It can parse data files and redo/undo logs to recover data.

null 23 Jul 5, 2022
Dumpling is a fast, easy-to-use tool written by Go for dumping data from the database(MySQL, TiDB...) to local/cloud(S3, GCP...) in multifarious formats(SQL, CSV...).

?? Dumpling Dumpling is a tool and a Go library for creating SQL dump from a MySQL-compatible database. It is intended to replace mysqldump and mydump

PingCAP 261 Jul 14, 2022
A river for elasticsearch to automatically index mysql content using the replication feed.

Mysql River Plugin for ElasticSearch The Mysql River plugin allows to hook into Mysql replication feed using the excellent python-mysql-replication an

null 160 Jun 1, 2022
Go-miprimercrud - Mi Primer Crud - GO - Postgres

Mi Primer Crud - GO - Postgres Instalar driver Postgres go get -u github.com/lib

null 0 Jan 24, 2022
WAL-G is an archival restoration tool for PostgreSQL, MySQL/MariaDB, and MS SQL Server (beta for MongoDB and Redis).

WAL-G is an archival restoration tool for PostgreSQL, MySQL/MariaDB, and MS SQL Server (beta for MongoDB and Redis).

null 2.3k Jul 31, 2022
A Go rest API project that is following solid and common principles and is connected to local MySQL database.

This is an intermediate-level go project that running with a project structure optimized RESTful API service in Go. API's of that project is designed based on solid and common principles and connected to the local MySQL database.

Kıvanç Aydoğmuş 21 Jun 6, 2022
BQB is a lightweight and easy to use query builder that works with sqlite, mysql, mariadb, postgres, and others.

Basic Query Builder Why Simple, lightweight, and fast Supports any and all syntax by the nature of how it works Doesn't require learning special synta

Aaron M 39 Jul 22, 2022
An experimental toolkit for injecting alternate authentication strategies into a PostgreSQL-compatible wire format.

PG Auth Proxy This is an experimental toolkit for injecting alternate authentication strategies into a PostgreSQL-compatible wire format. This is a pr

Cockroach Labs 1 Jan 20, 2022
MySQL replication topology management and HA

orchestrator [Documentation] orchestrator is a MySQL high availability and replication management tool, runs as a service and provides command line ac

null 4.6k Aug 10, 2022
Interactive client for PostgreSQL and MySQL

dblab Interactive client for PostgreSQL and MySQL. Overview dblab is a fast and lightweight interactive terminal based UI application for PostgreSQL a

Daniel Omar Vergara Pérez 222 Jul 29, 2022
Interactive terminal user interface and CLI for database connections. MySQL, PostgreSQL. More to come.

?? dbui dbui is the terminal user interface and CLI for database connections. It provides features like, Connect to multiple data sources and instance

Kanan Rahimov 96 Jul 31, 2022
MySQL Storage engine conversion,Support mutual conversion between MyISAM and InnoDB engines.

econvert MySQL Storage engine conversion 简介 此工具用于MySQL存储引擎转换,支持CTAS和ALTER两种模式,目前只支持MyISAM和InnoDB存储引擎相互转换,其它引擎尚不支持。 注意:当对表进行引擎转换时,建议业务停止访问或者极少量访问时进行。 原

null 5 Oct 25, 2021
Devcloud-go provides a sql-driver for mysql which named devspore driver and a redis client which named devspore client,

Devcloud-go Devcloud-go provides a sql-driver for mysql which named devspore driver and a redis client which named devspore client, you can use them w

HUAWEI CLOUD 11 Jun 9, 2022