This project consist of the following services:
Main REST service for banking app.
Learning objectives:
- Mechanism of HTTP web server
- Handler Functions and Router (Request Multiplexer)
- Request and Response Headers
- Converting (Marshal) data structures to JSON and XML
- Connecting and Working with MySQL DB
- Introduce structured logger by zap
- Introduce Sqlx for dealing with MySQL DB
- Introduce Data Transfer Object (DTO) to interact between user side <-> business side <-> server side
Following env vars are required to run the app:
SERVER_ADDRESS
SERVER_PORT
DB_USER
DB_PASSWD
DB_PORT
DB_ADDR
DB_NAME\
Currently set in start.sh
for local environment
GET /customers -> get all customers in JSON from local MySQL DB
GET /customers/{numeric customer id} -> get single customer as JSON by id
GET /customers?status=active | inactive -> get all customers by status.
POST /customers/{customer id}/account/{account id} -> make a transaction that can be "Deposit" or "Withdraw".
POST /customers/{customer id}/account -> Create new account that can be "Saving" or "Checking"
GET /mock/customers -> get all mock customers in JSON from mock slice of customers
GET /mock/customers/{numeric customer id} -> get single mock customer as JSON by id
GET /mock/customers/{numeric customer id} -> get single mock customer as JSON by id
GET /mock/customers?status=active | inactive -> get all customers by status.