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: 7 months 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 (9 months ago)
- Default Branch: main
- Last Pushed: 2024-10-30T01:18:43.000Z (9 months ago)
- Last Synced: 2024-12-07T03:08:00.621Z (7 months ago)
- Topics: gin-gonic, go, json, jwt-token, logger, mysql, self-development, yaml
- Language: Go
- Homepage: http://go.arielaia.cn/
- Size: 24.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# マイ プロジェクトー
#### セキュリティのお知らせ
- app_key: 1234
- secret: abcd
- version: v1.0
- sub_code: fee431abhd4772#### 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 を利用してインストールします、airを使ってる。
```
go install github.com/cosmtrek/air@latestair init
./air
```###### 3、config ファイルなど
```tree
注意: ファイルの名前は、点の後ろの名前は”ael”で設定します。
aelファイルを解析します。
── config
│ ├── db.json ## db.ael
│ ├── config.json ## config.ael
│ ├── .env.json ## .env.ael
```
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.