https://github.com/pedrogao/jerry
a template of restful api use gin
https://github.com/pedrogao/jerry
gin golang rest-api
Last synced: 9 months ago
JSON representation
a template of restful api use gin
- Host: GitHub
- URL: https://github.com/pedrogao/jerry
- Owner: pedrogao
- Created: 2018-11-13T14:35:54.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-10T14:01:27.000Z (almost 7 years ago)
- Last Synced: 2025-04-11T11:58:06.209Z (12 months ago)
- Topics: gin, golang, rest-api
- Language: Go
- Size: 54.7 KB
- Stars: 11
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gin-rest-template
> 一个使用gin开发restful api应用的模板
## 代理
**国内容易被墙,推荐设置proxy**
```sh
export GOPROXY=https://goproxy.io
```
## 配置
使用viper读取和使用配置,环境变量的前缀的`JERRY`。
## 运行
### 懒人版
```bash
./run.sh
```
### 详细版
先进行编译:
```bash
export GOPROXY=https://goproxy.io
go build -o jerry jerry.go
```
由于使用的是go module,在build的期间会默认下载需要的所有依赖,等待时间较长,耐心等待。
运行:
```bash
export JERRY_ADDR=:5000
export JERRY_RUNMODE=release
./jerry
```
## TODO LIST
- [x] 全局异常处理
- [x] 参数检验
- [x] 多级路由,路由分层,路由前缀
- [x] JWT 支持
- [x] 日志记录
- [x] ORM 框架集成
- [x] 配置文件驱动
- [x] cors跨域
- [x] 测试驱动
- [ ] 优化,美观
> 以高度封装带来的简单性,并不会带来真正的简单,只会带来更加的复杂