Skip to content

kiaplayer/clean-architecture-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'

About

Clean architecture example (with tests and database transactions support)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages