Golang using gin framework - Wallet Management
-
- This project is build with Wallet Management
-
- Step to use:
- Install mysql & create schema
wallet
, after that run project to create tables - Import gin-api.postman_collection.json to have apis for postman test
- Run project:
go run main.go
- Register a user: localhost:3001/api/v1/register, should register two (1 admin, 1 merchant user). To make user become admin, go to mysql db and change RoleID to 1
- With dev environment, register api will return token in data response, take it to activation account:
localhost:3001/api/v1/activation/:token
- To set up user have Admin permission, go to db and edit RoleID of user to 1
- Login admin user (roleID = 1) to get token authen:
http://localhost:3001/api/v1/login
- By default, user have no Wallet, create wallet with default balance 0 (admin role):
localhost:3001/api/v1/wallet
- To view all wallet of user (users themselves or admin role), use api:
localhost:3001/api/v1/wallets
- Can delete wallet at (only admin role):
localhost:3001/api/v1/wallet/:wallet_id
, beware that wallet not actually delete, it just de-activate (we don't delete data on real-case) - Deposit to wallet (admin role):
localhost:3001/api/v1/deposit
- View deposits (admin role or users themselves):
localhost:3001/api/v1/deposits
- Update user email (admin role):
localhost:3001/api/v1/update-email
- Containerize Application Using Docker
- Protected Route Using JWT
- Integerate ORM Database Using Gorm
- API Documentation Using Swagger
- Validation Request Using Go Playground Validator
- Integerate Unit Testing
- And More
-
- Install node modules
$ go get . || go mod || make goinstall
- Build application
$ go build -o main || make goprod
- Start application in development
$ go run main.go | make godev
- Test application
$ go test main.go main_test.go || make gotest