Files
go-common/templates/README.md

18 lines
750 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.

# 模板
复制到业务项目后,按注释中的挂载点扩展即可。
| 文件 | 默认已接好 | 主要改哪里 |
|------|------------|------------|
| `server/main.go` | MustInit、日志、Warmup、默认中间件链、NewHandler、Close`-config`/`-addr` | `buildOptions` / `setupMiddleware` / `registerRoutes` |
| `migrate/main.go` | MustInit、日志、Database Warmup、Migrator、Close`-config`/`-dir` | `buildOptions`SQL 放 `migrations/` |
| `Dockerfile.example` 等 | 镜像 / Compose / Makefile 示例 | 按部署环境改 |
```bash
mkdir -p cmd/server cmd/migrate
cp templates/server/main.go cmd/server/main.go
cp templates/migrate/main.go cmd/migrate/main.go
```
对接说明:[INTEGRATION.md](../INTEGRATION.md)。