# IrisAdminApi
**Repository Path**: kaopuke/IrisAdminApi
## Basic Information
- **Project Name**: IrisAdminApi
- **Description**: iris 框架的后台api项目
- **Primary Language**: Go
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 6
- **Created**: 2021-06-21
- **Last Updated**: 2022-05-24
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
IrisAdmin
> 简单项目仅供学习,欢迎指点!
[IRIS V12 中文文档](https://github.com/snowlyg/iris/wiki)
###### `Iris-go` 学习交流 QQ 群 :`676717248`
---
#### 项目开发过程详解
1.[Iris-go 项目登陆 API 构建细节实现过程](https://blog.snowlyg.com/iris-go-api-1/)
2.[iris + casbin 从陌生到学会使用的过程](https://blog.snowlyg.com/iris-go-api-2/)
---
- 安装项目依赖
>加载依赖管理包 (解决国内下载依赖太慢问题)
>使用国内七牛云的 go module 镜像。
>
>参考 https://github.com/goproxy/goproxy.cn。
>
>阿里: https://mirrors.aliyun.com/goproxy/
>
>官方: https://goproxy.io/
>
>中国:https://goproxy.cn
>
>其他:https://gocenter.io
##### golang 1.13+ 可以直接执行:
```shell script
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
```
- 复制配置文件
```
cp application.example.yml application.yml
```
> 修改配置文件 `application.yml`
- 运行项目
>如果想使用 `go run main.go --config ` 命令运行,注意不用 --config 指定配置路径,将无法加载配置文件
```
# --config 指定配置文件绝对路径
go run main.go --config /Users/snowlyg/go/src/github.com/snowlyg/IrisAdminApi/application.yml
```
>推荐使用 air 热编译工具
```
# 安装工具 air
go get -u github.com/cosmtrek/air
cp .air.example.conf .air.conf # 复制后修改 .air.conf 文件,默认为 mac 环境
air
```
- 填充数据, 注意配置文件同项目配置文件,权限数据位于 tools/seed/data
```
go build -o seed tools/seed/main.go
# --path 指定目录即可
./seed --config /Users/snowlyg/go/src/github.com/snowlyg/IrisAdminApi/application.yml --path /Users/snowlyg/go/src/github.com/snowlyg/IrisAdminApi/tools/seed/data
```
#### 报错 Error 1071: Specified key was too long; max key length is 1000 bytes
- 修改数据库引擎为 InnoDB
#### postman 接口
```text
https://www.getpostman.com/collections/048078cdfd16667352b0
```
#### 运行测试
```
go test ./...
```
#### 感谢
[JetBrains](https://www.jetbrains.com/?from=IrisAdminApi) 对本项目的支持。