rioputroo / go-hexagonal-gorm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sample Golang API Server

Sample REST API build using echo server.

The code implementation was inspired by port and adapter pattern or known as hexagonal:

  • Business
    Contains all the logic in domain business. Also called this as a service. All the interface of repository needed and the implementation of the service itself will be put here.
  • Modules
    Contains implementation of interfaces that defined at the business (also called as server-side adapters in hexagonal's term)
  • Controller
    Controller http handler or api (also called user-side adapters in hexagonal's term)

golang clean architecture

Data initialization

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

How To Run Server

Just execute code below in your console

./run.sh

How To Consume The API

To make it easier please download Insomnia Core app and import this collection.

About

License:Apache License 2.0


Languages

Language:Go 99.2%Language:Shell 0.8%