Skip to content

Latest commit

 

History

History
110 lines (81 loc) · 2.48 KB

README.md

File metadata and controls

110 lines (81 loc) · 2.48 KB

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