Skip to content

wwfyde/demo-gin

Repository files navigation

Demo Gin

Introduction

This is a pure API service with Gin.

References Links

参考链接和项目, 灵感启发来源, 范本

Dependencies

  • swag
    • gin-swagger
  • zap
  • cobra
  • viper
  • gorm
  • mongo
  • mysql
  • redis
  • godotenv # load .env files

Project Layout

Project Layout Example Generated By AI Assistant

.
├─ api            # API Protocols, Definitions and Middleware
├─ bin            # Compiled Binaries
├─ cmd            # Application Startups, contains 'main' functions
│   └─ server     # The name of the microservice
│       └─ main.go
├─ internal       # Private Application and Library Code
├─ pkg            # Public library code (e.g., models, utilities)
├─ web            # Web UI
├─ scripts        # Scripts for tooling
├─ .gitignore     # Specifies intentionally untracked files to ignore
├─ Dockerfile     # Instructions to create a Docker image
├─ go.mod         # Go Modules dependencies
├─ go.sum         # Contains the expected cryptographic checksums of the content of specific module versions
└─ README.md      # Project Overview and Instructions

models and handlers

  1. keep both in the same directory, just like go-gin-example

Quickstart

Run in docker

# build docker image for current demo-gin
docker build -t demo-gin .

docker run --rm -p 8000:8000 --name demo-gin -it demo-gin 

swag

Add notations for main function and each handle-func, then use swag init to generating docs. Please Notice that register swagger router to main router

Developing Plan

See GitHub project demo-gin

Note: the link above may be unusable because it's a private project.

About

A demo gin app for experimental purpose.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published