Skip to content

yopeso/hexagonal-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hexagonal Go Workshop

Presentation

Structure

  • src/shortener - "business logic", defines the adapters (interfaces) and contains the logic to use them (service)
  • src/repository- implementations for different repositories that implement the required interface
  • src/serializer- implementations for different serializers that implement the interface
  • src/metrics - counters for prometheus metrics (might also be a part of shortener as they can be business logic metrics)
  • src/api - api handlers that create handlers for exposed endpoints to create/use URLs

Endpoints

  • / - Mandatory Hello World (GET)
  • /:code - redirect to URL identified by code (GET)
  • /url - post a json/msgpack payload to create a new URL and receive associated code

Prerequisites

  • Docker
  • VSCode with REST Client extension required to use the test.http file to interact with the API

Improvements (Homework)

  • return responses based on an accept header (eg: have other serializer(s) port(s) to provide responses)
  • add validation to check whether requests represent valid URLs
  • experiment with different ways to switch between backends
  • experiment with using different backends alternatively
  • add another backend

About

Hexagonal go Workshop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published