Skip to content

dinorain/kalobranded

Repository files navigation

Kalobranded: Go REST example for branded product checkout service

Assumptions:

  • Each brand has it own pickup_address
  • Validations for related resource are done in delivery layer. e.g. brand_id in product create.
  • Two roles are available for table users, which are "admin" and "user". Anyway, records of either roles can be created from guest http API.
  • Token-based authentication, and save auth session too

What have been used:

  • net/http - Standard library as multiplexer or router
  • sqlx - Extensions to database/sql.
  • pgx - PostgreSQL driver and toolkit for Go
  • JWT - A Go implementation of JSON Web Tokens.
  • viper - A Go configuration with fangs
  • go-redis - Redis client for Golang
  • zap - Logger
  • validator - Go Struct and Field validation
  • migrate - Database migrations. CLI and Golang library.
  • testify - Testing toolkit
  • gomock - Mocking framework
  • CompileDaemon - Compile daemon for Go
  • Docker - Docker

Docker compose files:

docker-compose.local.yml

or

docker-compose.dev.yml

Docker development usage:

make develop

Local development usages:

make local

or

make run

How to

After deployment, run

make migrate_up

Register admin and buyer user from http://localhost:5001/user/create

Swagger:

http://localhost:5001/swagger/ or http://139.162.7.112:5001/swagger/ (test)

Test Accounts:

Admin

curl -X POST                                                   \
    -d '{
        	"email": "admin@gmail.com",
        	"password": "admin"
        }' \
    http://139.162.7.112:5001/swagger/index.html#/Users/post_user_login

Buyer

curl -X POST                                                   \
    -d '{
        	"email": "djourdan555@gmail.com",
        	"password": "hello"
        }' \
    http://139.162.7.112:5001/swagger/index.html#/Users/post_user_login

About

Go REST example for branded product checkout service, using Go's standard library for multiplexing and routing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages

Generated from dinorain/checkoutaja