ashkan90 / simple-key-store-project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple Key-Store Example

example workflow

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 with github actions and it's containerized

Author

👤 Emirhan Ataman

📝 License

Copyright © 2021 Emirhan Ataman.

About


Languages

Language:Go 98.1%Language:Dockerfile 1.9%