/Arch-Hexagonal-Fiber

Project with Fiber (Golang)

Primary LanguageGo

Project logo

[Architecture Hexagonal, Dependency Injection, Swagger, Unit-Test]

Status GitHub Pull Requests License


Use of Fiber Web Framework, hexagonal architecture, dependency injection, unit test and very good practices.

📝 Table of Contents

🧐 About

This project has enough foundation to understand Fiber, it should be noted that this project is written in golang and effectively uses clean architecture like hexagonal.

💾 Documentation

Design Database

🏁 Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Go v1.16 or higher

go version

Installing

Configure the variables environment in docker-compose, reference the config structure inside the cmd/api/boostrap.go file.

type config struct {
	// Server configuration
	Host            string        `default:"localhost"`
	Port            uint          `default:"4000"`
	ShutdownTimeout time.Duration `default:"10s"`
	// Database configuration
	DbUser    string        `default:"test"`
	DbPass    string        `default:"test"`
	DbHost    string        `default:"localhost"`
	DbPort    uint          `default:"3306"`
	DbName    string        `default:"test"`
	DbTimeout time.Duration `default:"5s"`
}
api:
    build: .
    environment:
      FIBER_HOST: 0.0.0.0
      FIBER_DBHOST: mysql
    ports:
      - 8080:4000

Add project dependencies

go get

Run the application in development

go run ./cmd/api/main.go

If all went well visit the next page

localhost:{your_port}

🔧 Running the tests

run the tests

go test

🎈 Usage

To view and interact with API REST visit the documentation.

localhost:{your_port}/api-docs

🚀 Deployment with Docker

docker-compose up -d

⛏️ Built Using

✍️ Authors