2021-09-06 初学Go写的小应用,现在[2024-12-20]重启并重构优化。
git clone [repository-url]
cd short_link_API
go mod tidy
export DB_HOST=localhost
export DB_PORT=3306
export DB_USER=slink
export DB_PASSWORD=yourpassword
export DB_NAME=test
export SERVER_PORT=9090
使用 schema.sql 文件在MySQL中创建表结构
go run main.go
详细的API文档请参考 API文档
运行测试:
go test -v
├── config - 配置管理 ├── database - 数据库连接管理 ├── models - 数据模型 ├── handlers - HTTP处理器 ├── utils - 工具函数 ├── docs - 文档 ├── main.go - 主程序入口 ├── api_test.go - 测试文件 └── schema.sql - 数据库表结构