Skip to content

A simple RESTful API built with the Go programming language, Hexagonal Architecture, MySQL and Docker

Notifications You must be signed in to change notification settings

TiagoDiass/golang-hexagonal-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Hexagonal API

This is a simple REST API built with the Go programming language, Hexagonal Architecture, MySQL and Docker.

Repo's top languages

Endpoints

In this API you'll find endpoints related to a CRUD of products

Request name Method Endpoint Request body Returns
GetProducts GET /products No body All products
GetProductById GET /products/{productId} No body A single product
CreateProduct POST /products JSON with the properties
name: string, price: integer
The created product
DeleteProduct DELETE /products/{productId} No body Nothing

▶️ How to run

First steps

If you want to run the application in your computer, follow these steps;

First of all, you'll need to have these tools installed on your computer

Assuming you have those tools installed on your computer, you'll first need to clone the repository and install the dependencies,

Follow the steps bellow:

# Clone the repo
$ git clone https://github.com/TiagoDiass/golang-hexagonal-api.git

# Enter the repo's folder
$ cd golang-hexagonal-api

# Install the dependencies
$ go mod download

Application

To run the application, just follow the steps below (assuming you have followed the first steps above)

# Start the Docker container
$ docker compose up -d

# Enter in the app directory inside Docker container
$ docker compose exec goapp bash

# Start the app
$ go run cmd/app/main.go

After followings these steps, you'll have the backend server running in your localhost:8000. If you want to stop the application you can just press CTRL+C in your terminal where you started the app.

Tasks

  • Create a swagger for the API endpoints
  • Add unit tests

About

A simple RESTful API built with the Go programming language, Hexagonal Architecture, MySQL and Docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages