- Author: donghquinn
- gin: Web Framework
go get -u github.com/gin-gonic/gin
-
Gin Usage
- Post Body Data Parsing
- Bind with Body Data Structures.
- Structure can be defined with expression
json:"body1" xml:"body1" binding:"required"
- can be validate with ShouldBind() method
- Post Body Data Parsing
-
godotenv: load .env file
go get -u github.com/joho/godotenv
- prisma: Data ORM Client
go get -u github.com/steebchen/prisma-client-go
- validator: Request Validator. You don't need to install package manually.
- How to make custom validator: Korean Reference
- Unlike node.js, you can validate requests by tags.
- And of course, you can make custom tags as well: Korean Reference
- If you get Prisma Module, Please make schema, File name is schema.prisma. Check prisma/schema.prisma as reference on this repository.
- Run Database you want, and write its dataurl into .env file.
- format:
[databaseType]://[userName]:[userPassword]@[hostAddr]:[hostPort]/[databaseName]?schema=[public / private]
- format:
- Then Run command below to initiate prisma client. This command line will create the package name "db"
go run github.com/steebchen/prisma-client-go generate
- Prisma Client and Query Modules
- Data Transfer Object
- Formulized Response with throw keys;
- resCode: Response Code - 200 / 40* /500
- dataRes: Actual Result of Request
- errMsg: There would be Error message, if there were any error happend.
- Formulized Response with throw keys;
- calculator: Simple functions add / sum
- handler: router Handling Modules
- shutdown: Graceful Shutdown
- calc_request: Calculation Request Type Definition