Continue from previous material go-3-db-digi, Now we will decoupled our Auth into single service to handle auth.
While other will be Account Service also act as API Gateway.
One big major point is, auths table now owned by Auth Service (logically it can separate into differentF database)
- Decoupled into 2 Services: Account and Auth
- Protobuf
- Implement gRPC Handler
- Communicate Account Service to Auth Service via gRPC
- REST API with Gin
- Read JSON Request to Model/Struct and do JSON Response
- Connect to Postgres Database with GORM
- Do Query CRUD when calling REST API
-
auths (Owned by Auth Services)
- auth_id: bigint, autoincrement
- account_id: bigint
- username: varchar
- password: varchar
-
accounts (Owned by Account Services)
- account_id: bigint
- name: varchar
- /auth/login -> Auth Service Auth/Login
- /auth/upsert -> Auth Service Auth/Upsert
- /account/create
- /account/read
- /account/update
- /account/delete
- /account/list
- /account/my -> Middleware Validate Token to Auth Service Auth/Validate
- Auth/Login
- Auth/Upsert
- Auth/Validate
- Including Code Tour
- Each topic has spesific commit
- Script to automatically reclone with spesific commit, see on vscode-open-commit.sh
- Clone repository
- Open with VSCode
- Don't forget to install Golang
- Have Postgres and Import DDL to your Database
- Enable Golang VSCode extension
- Enable Codetour VSCode extension (https://marketplace.visualstudio.com/items?itemName=vsls-contrib.codetour)
- Follow Codetour topic and step, each topic has script to automatically reclone with spesific commit.
If you have any questions or encounter any issues, feel free to open an issue and we will assist you in resolving them.
Feel free to contribute, don't forget to mention if needed