Simple Key-Store Example
This project aims to implement very simple in-memory key store by using go routine with Hexagonal Architecture.
✨ Project Runs On
Hexagonal Architecture
The idea of Hexagonal Architecture is to put inputs and outputs at the edges of our design. Business logic should not depend on whether we expose a REST or a GraphQL API, and it should not depend on where we get data from — a database, a microservice API exposed via gRPC or REST, or just a simple CSV file.
The pattern allows us to isolate the core logic of our application from outside concerns. Having our core logic isolated means we can easily change data source details without a significant impact or major code rewrites to the codebase.
Run on Local Machine
go get .
PORT=8080 go run ./cmd/
Endpoints
GET /key?key=myKey
POST /key ## needs json payload as body
Example Usages
curl --location --request POST 'http://localhost:8080/key' \
--header 'Content-Type: application/json' \
--data-raw '{
"key": "k",
"value": "v"
}'
curl --location --request GET 'http://localhost:8080/key?key=myKey'
Run Tests
go test ./...
go test -race ./domain/*
Deployment
To deploy the case, I used
Heroku
. The deployment is automated withgithub actions
and it'scontainerized
Author
📝 License
Copyright © 2021 Emirhan Ataman.