Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arielea/gindemo
๐ A basic go-gin demo
https://github.com/arielea/gindemo
gin-gonic go json jwt-token logger mysql self-development yaml
Last synced: 29 days ago
JSON representation
๐ A basic go-gin demo
- Host: GitHub
- URL: https://github.com/arielea/gindemo
- Owner: ArielEa
- Created: 2024-10-15T15:12:16.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-10-16T08:57:59.000Z (about 1 month ago)
- Last Synced: 2024-10-16T22:28:16.795Z (30 days ago)
- Topics: gin-gonic, go, json, jwt-token, logger, mysql, self-development, yaml
- Language: Go
- Homepage: http://go.arielaia.cn/
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# My Project
#### Package Install
##### Init Project
```
go mod init project_namego run main.go
```##### Install gin-gonic/gin moudle
```
go get -u github.com/gin-gonic/gin
```##### Install Air (Hot Reload) - ใใใใชใญใผใ
###### 1ใ git ใใ
```
git clone https://github.com/cosmtrek/air.gitcd air
go build -o project_directly
cd project
./air
```###### 2ใgo ใๅฉ็จใใฆใคใณในใใผใซใใพใ
```
go install github.com/cosmtrek/air@latestair init
./air
```###### 3ใconfig ใใกใคใซใชใฉ
```tree
โโ config
โย ย โโโ db.json
โย ย โโโ config.json
โย ย โโโ .env.json
```
db.json
```json
{
"prod": {
"user": "user id",
"password": "password",
"host": "host.url",
"port": "3306",
"dbname": "dbname",
"charset": "utf8mb4",
"parseTime": "True",
"loc": "Asia/Tokyo"
},
"test": {
},
"development": {
}
}
```.env.json
```json
{
"gin_mode": "debug" // debug, prod, test
}
```config.json
```json
{
"port": 1234, // your custom port
"db": true,
"redis": false,
"cache": true,
"log": true,
"environment_checker": true,
"error_warning": true,
"console_error":false,
"auto_db_checker": true,
"listener": false,
"test": true
}
```###### 4ใใฆใงใใตใคใใใใใฆใณใญใผใใใพใ
###### https://github.com/air-verse/air/releases ใใผใธใซ่จชๅใใฆ้ฉๅใชใใใทใงใณใ้ธๆใใใใฆใณใญใผใใใพใThis project is a simple web application built with Go.
## Project Structure
- [README.md](#readme-md)
- [main.go](#main-go)
- [config/](#config)
- [config.go](#config-go)
- [settings.go](#settings-go)
- [controllers/](#controllers)
- [home_controller.go](#home-controller-go)
- [user_controller.go](#user-controller-go)
- [models/](#models)
- [user.go](#user-go)
- [product.go](#product-go)## File Descriptions
ใใญใธใงใฏใใฎใใญใฅใกใณใใใใญใธใงใฏใใฎๆฆ่ฆใใปใใใขใใๆ้ ใใใฎไปใฎ้่ฆใชๆ ๅ ฑใๅซใพใใใพใใ
The entry point of the application. This file contains the main function that starts the server and initializes the application.
Contains configuration files.
Handles the loading and management of configuration settings.
Contains specific configuration settings for different environments or services.
Handles the application logic for different routes.
Manages the logic for the home page and related routes.
Manages user-related routes and functionality, such as user registration and login.
Defines data models representing entities in the application.
Defines the `User` model and its associated methods.
Defines the `Product` model and its associated methods.