Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

grapi

> 开发工具
Open source

This is a gin restful api.

185 stars0 likes1 views
WebsiteGitHub

About

This is a gin restful api.

grapi

What is this?

  • by: axiner
  • grapi
  • This is a gin restful api.

脚手架使用

  • 1)mod及proxy设置(若已执行或不需要请忽略)
    • go env -w GO111MODULE=on
    • go env -w GOPROXY=https://goproxy.io,direct
  • 2)下载安装
    • go install github.com/atpuxiner/gtools/gtcli@latest
  • 3)创建项目
    • gtcli grapi new -p -m -d
  • 4)添加api
    • cd到上面创建的项目根目录
    • gtcli grapi add -a -v

项目运行

  • 1)cd到项目根目录
  • 2)初始化相关
    • 第三方模块:
      • go get -u
      • go mod tidy
      • swag cmd:
        • go install github.com/swaggo/swag/cmd/swag@latest
    • 代码格式化:
      • go fmt ./...
    • swagger:
      • swag init
  • 3)编译运行
    • win:
      • go build -o grapi.exe main.go
      • ./grapi.exe runserver
    • linux:
      • go build -o grapi main.go
      • ./grapi runserver

项目结构

  • ABD: ABD模式
    • A api
    • B business
    • D datatype
  • 调用过程: main.go(initializer) - router(middleware) - api - business - (datatype)
  • 结构如下: (命名经过多次修改敲定,简洁易懂,ABD目录贴合避免杂乱无章)
…

LICENSE

This project is released under the MIT License (MIT). See LICENSE

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gogingin-restful-apigolanggrapi

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具