GithubHelp home page GithubHelp logo

felfbcn / go-hexagonal_http_api-course Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codelytv/go-hexagonal_http_api-course

0.0 0.0 0.0 113 KB

Ejemplos del curso de API HTTP en Go aplicando Arquitectura Hexagonal

Home Page: https://pro.codely.tv/library/api-go-hexagonal

Go 99.89% Dockerfile 0.11%

go-hexagonal_http_api-course's Introduction

CodelyTV - Go HTTP API - Hexagonal Architecture

This repository contains the code examples used on the CodelyTV course.

Requirements

  • Go v1.15+
  • MySQL (see below).

Contents

This project has been designed as a single Go module with multiple applications. Each folder contains a completely functional application (binary) that can be executed isolated.

Each folder corresponds to one of the course lessons / videos:

  1. 01-01-your-first-http-endpoint - Nuestro primer endpoint HTTP en Go
  2. 01-02-using-gin - Usando Gin: nuestro primer framework
  3. 01-03-architectured-healthcheck - Arquitecturando nuestro health check
  4. 02-01-post-course-endpoint - Implementando el endpoint de creación de curso
  5. 02-02-repository-injection - Inyectando nuestro repositorio
  6. 02-03-controller-test - Testeando nuestro endpoint
  7. 02-04-domain-validations - Añadiendo validaciones a nuestro dominio
  8. 03-01-mysql-repository-implementation - Implementando nuestro repositorio para MySQL
  9. 03-02-repository-test - Testeando nuestro repositorio
  10. 04-01-application-service - Refactorizando el endpoint para extraer el Application Service
  11. 04-02-application-service-test - Testeando el Application Service
  12. 04-03-command-bus - Unificando nuestros casos de uso: Command Bus
  13. 05-01-graceful-shutdown - Graceful shutdown
  14. 05-02-timeouts - Timeouts en operaciones asíncronas: repositorio
  15. 06-01-http-middlewares - Usando middlewares HTTP en Go
  16. 06-02-time-parse-in-go - El secreto mejor guardado de Go y sus fechas
  17. 06-03-gin-middlewares - Implementando el middleware de recuperación de errores en Gin
  18. 07-01-publishing-domain-events - Publicando eventos de curso creado
  19. 07-02-domain-events-subscriber - Implementando nuestro suscriptor de eventos
  20. 07-03-event-bus-implementation - Implementando el Event Bus
  21. 08-01-reading-env-variables - Leyendo configuración de variables de entorno
  22. 08-02-build-and-deploy - Build, despliegue y ¡a producción!
  23. 08-03-debugging - Generando la imagen de Docker y depurando errores

Usage

To execute the application from any lesson, just run:

export COURSE_LESSON=02-04-domain-validations; go run $COURSE_LESSON/cmd/api/main.go 

Replacing COURSE_LESSON value by any of the available ones.

Simple examples

Some lessons only contain a single main.go file with a few lines of code. To run one of those lessons, just run:

export COURSE_LESSON=01-01-your-first-http-endpoint; go run $COURSE_LESSON/main.go 

MySQL & Docker

From 02-01-post-course-endpoint on, the application on each directory relies on a MySQL database. So, to simplify its execution, we've added a docker-compose.yaml file with a MySQL container already set up.

To run it, just execute:

docker-compose up -d 

You can also use your own MySQL instance. Note that those applications expects a MySQL instance to be available on localhost:3306, identified by codely:codely and with a codely database.

To set up your database, you can execute the schema.sql file present on the sql directory. It's automatically loaded if you use the provided docker-compose.yaml file.

Tests

To execute all tests, just run:

go test ./... 

To execute only the tests present in one of the lessons, run:

go test ./02-04-domain-validations/... 

go-hexagonal_http_api-course's People

Contributors

joanlopez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.