This is example project to demonstrate DI implementation in Go using dig from Uber.
You need to create database by running ./init_db.sh
script.
go run cmd/server/main.go
- run servergo run cmd/create_message_command/main.go "Hi, %s."
- run command that creates new message in databasego test -v ./...
- run tests
curl 127.0.0.1:8080/hello
- greeting message for unknown user
curl 127.0.0.1:8080/hello?userId=1
- greeting message for concrete user
curl -X POST --data "test" 127.0.0.1:8080/echo
- sends back in response request body