🚀 The Premier Go Web Scaffold - Your #1 Starting Point for Go Web Projects
go-uno is a meticulously crafted, production-ready web application scaffold built with Go. It embodies best practices and clean architecture to kickstart your next project with speed and confidence.
go-uno 是一个基于 Go 语言的 Web 应用脚手架,旨在提供一个快速、可靠的起点来构建生产级别的 Web 服务。它集成了 Gin 框架、Cobra CLI 工具和 Viper 配置管理,并遵循清晰的架构设计,帮助开发者专注于业务逻辑的实现。
- Gin 框架: 高性能的 HTTP Web 框架。
- Cobra CLI: 强大的命令行接口工具,方便构建命令行应用。
- Viper 配置管理: 灵活的配置解决方案,支持多种格式和热加载。
- 清晰的架构: 采用分层设计,易于理解和扩展。
- 优雅的关机: 支持平滑关机,确保请求得到妥善处理。
- Go 1.18+ 环境
git clone https://github.com/rushairer/go-uno.git
cd go-uno使用 make 命令:
make./bin/gouno web --config ./config/config.yaml --address 0.0.0.0 --port 8080 --debug默认情况下,Web 服务将在 http://0.0.0.0:8080 启动。
--config或-c: 指定配置文件路径,默认为./config/config.yaml。--address或-a: 指定监听地址,默认为0.0.0.0。--port或-p: 指定监听端口,默认为8080。--debug或-d: 开启调试模式,默认为false。
配置文件位于 ./config/config.yaml,您可以根据需要修改其中的配置项。
web_server:
address: 0.0.0.0
port: 8080
debug: false项目提供了一个简单的 /test/alive 路由示例,用于检查服务是否存活。
curl http://localhost:8080/test/alive
# Expected output: pong欢迎通过以下方式为 go-uno 贡献代码:
- Fork 本仓库。
- 创建您的特性分支 (
git checkout -b feature/AmazingFeature)。 - 提交您的更改 (
git commit -m 'Add some AmazingFeature')。 - 推送到分支 (
git push origin feature/AmazingFeature)。 - 提交 Pull Request。
本项目采用 MIT 许可证。详情请参阅 LICENSE 文件。