Skip to content

ArielEa/GinDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

マイ プロジェクトー

セキュリティのお知らせ

  • app_key: 1234
  • secret: abcd
  • version: v1.0
  • sub_code: fee431abhd4772

Package Install パッゲージのインストール

Init Project プロジェクトの初期化
go mod init project_name

go 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.git

cd air

go build -o project_directly 

cd project

./air
2、go を利用してインストールします、airを使ってる。
go install github.com/cosmtrek/air@latest

air init 

./air
3、config ファイルなど
注意: ファイルの名前は、点の後ろの名前は”ael”で設定します。
       aelファイルを解析します。
── config
│   ├── db.json  ## db.ael
│   ├── config.json ## config.ael
│   ├── .env.json ## .env.ael

db.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

{
    "gin_mode": "debug" // debug, prod, test
}  

config.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

File Descriptions

README.md

プロジェクトのドキュメント、プロジェクトの概要、セットアップ手順、その他の重要な情報が含まれいます。

main.go

The entry point of the application. This file contains the main function that starts the server and initializes the application.

config/

Contains configuration files.

config.go

Handles the loading and management of configuration settings.

settings.go

Contains specific configuration settings for different environments or services.

controllers/

Handles the application logic for different routes.

home_controller.go

Manages the logic for the home page and related routes.

user_controller.go

Manages user-related routes and functionality, such as user registration and login.

models/

Defines data models representing entities in the application.

user.go

Defines the User model and its associated methods.

product.go

Defines the Product model and its associated methods.

Releases

No releases published

Packages

No packages published

Languages