Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 780 Bytes

README.md

File metadata and controls

29 lines (21 loc) · 780 Bytes

Clean architecture example

Simple service for orders management using сlean architecture principles.

Sqlite database is used as storage.

Default service configuration is loaded from .env file, but you can override any parameters from ENV.

How to run

  1. Run db migrations:
$ go install -tags 'sqlite3 sqlite' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
$ migrate -database "sqlite3://sqlite.db" -path db/migrations up
  1. Start service (on port 3000 by default):
$ go run cmd/main.go

How to use

$ curl --location 'localhost:3000/sale-order' \
--header 'Content-Type: application/json' \
--data '{"customer_id": 1, "products": [{"product_id":1, "quantity": 1}]}'

$ curl --location --request GET 'localhost:3000/sale-order?id=1'