1
0
mirror of https://github.com/ZSCNetSupportDept/website.git synced 2025-10-29 17:34:15 +08:00
Files
website/docs/devdocs/_后端API服务_/03-结构.md

23 lines
767 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 结构
仓库项目的结构如下:
`main.go`:项目程序的起点,从此处开始运行
`config`:存放了读取配置,提供配置变量相关的代码
`databases`:提供了连接数据库相关的代码,提供主数据库连接变量(Usingdb)
`handlers`:为handler的存放地点一类业务为一个对象handler作为其方法实现
`model`:业务所采用的模型,定义了一个业务对象的存储和相关方法
`use`:在这里注册所有需要提供的API和中间件,程序将使用这里的配置
`make`:存放了构建所产生的程序
`static`:存放了静态文件以进行路由
## 原理
当程序运行时:
main()将调用sysinit(),读取参数中的配置,将配置记录在全局变量`config.UseConfig`