Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 1.01 KB

README.md

File metadata and controls

43 lines (32 loc) · 1.01 KB

Simple CQRS(Mimic)

However, command and query services are coupled, only read and write queries are decoupled on the same service. Postgresql and Elasticsearch are being synced via Logstash.

Usage

docker-compose up

Migrate database(https://github.com/golang-migrate/migrate you will need to install this to be able to run migrate)

export PGURL="postgres://product:secret@localhost:5432/product?sslmode=disable"
migrate -database $PGURL -path business/data/migrations/ up

Insert a product

curl --location --request POST 'http://localhost:8000/v1/products' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Alarm paketi",
    "price": 5000000
}'

Delete a product(don't forget to change id)

curl --location --request DELETE 'http://localhost:8000/v1/products/37198ff6-bde2-47a7-8f8f-8c16a5cd0c11'

Search products

curl --location --request GET 'http://localhost:8000/v1/products?name=alarm'

Jaeger http://localhost:16686/search