di-demo
is a Go project that demonstrates the fundamentals of dependency injection and separation of concerns in a Golang
web server. It also showcases essential concepts such as authentication, context-based logging with traceability, and robust error handling.
Run cp .env.example .env
and change the configuration in the .env file with the actual values.
Then start the server
go run main.go
curl --header "Content-Type: application/json" \
--header "Authorization: Bearer 123abc" \
--request POST \
--data '{"name": "my-great-item", value:"Hello, World!"}' \
http://localhost:8085/item
curl --header "Authorization: Bearer 123abc" \
http://localhost:8085/item/1
go test ./...