Skip to content

Commit

Permalink
v1.2.0 修改说明文件
Browse files Browse the repository at this point in the history
  • Loading branch information
何全 committed May 16, 2019
1 parent b614a50 commit b8c5895
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 53 deletions.
50 changes: 30 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# Go Admin
# Go Web Admin

一个go api 后端例子,包含JWT,RBAC(Casbin),增删改查, 一键生成 Restful API接口(不依赖orm)。
> 一个Go Web Api 后端 简单例子,包含 用户、权限、菜单、JWT 、 RBAC(Casbin)等!
## 主要说明
* v1.1.2
> 附加功能: 一键生成 Restful API接口(不依赖orm)!
###
## 版本
* v1.2.0

##
* user
* username password
* role
* name
* menu
* name path method
* name path method

### 目录结构
## 目录结构
* conf:用于存储配置文件
* docs: 文档(SQL和API注释)
* logs: 日志
Expand All @@ -25,11 +27,11 @@
* test: 单元测试


### 权限验证说明
## 权限验证说明
> 利用的casbin库, 将 user role menu 进行自动关联
```
项目启动时,会自动加载权限. 如有更改,会删除对应的权限,重新加载.
项目启动时,会自动加载权限. 如有更改,会删除对应的权限,重新加载
用户关联角色
角色关联菜单
Expand All @@ -49,7 +51,7 @@ hequan test
登录接口 /auth 不进行验证
```

### 请求
## 请求

> 请求和接收 都是 传递 json 格式 数据
```
Expand All @@ -60,16 +62,17 @@ hequan test
"password": "123456"
}
访问 /api/v1/users
访问 /api/v1/users?page=2
请求头设置 Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

## How to run

### Required

- Mysql
- 部署 Mysql

### Ready

Expand All @@ -91,7 +94,7 @@ Name = go
TablePrefix = go_
```

## Installation
### Installation
```
yum install go -y
Expand All @@ -102,16 +105,20 @@ go get github.com/hequan2017/go-admin
cd $GOPATH/src/github.com/hequan2017/go-admin
go build main.go
go run main.go
```


## 热编译,开发时使用
### 热编译(开发时使用)
```bash

go get github.com/silenceper/gowatch

gowatch
```

### Run
## Run


```
Project information and existing API
Expand All @@ -125,10 +132,12 @@ Listening port is 8000
```

## 附加功能


* 不用orm依赖,直接输入表名字就可以 增删改查

```
get http://127.0.0.1:8000/api/restful/go_user
get http://127.0.0.1:8000/api/restful/go_user/1
post http://127.0.0.1:8000/api/restful/go_user
Expand All @@ -148,7 +157,7 @@ put http://127.0.0.1:8000/api/restful/go_user/2
delete http://127.0.0.1:8000/api/restful/go_user/2
```

### API 注释
## API 注释

> http://127.0.0.1:8000/swagger/index.html
Expand All @@ -170,7 +179,10 @@ delete http://127.0.0.1:8000/api/restful/go_user/2
## 开发者
* 何全


## 特别感谢


```
本项目主要参考了:
https://github.com/EDDYCJY/go-gin-example 包含更多的例子,上传文件图片等。本项目进行了增改。
Expand All @@ -183,6 +195,4 @@ https://gitee.com/konyshe/gogo 一行代码搞定RESTFul的轻量web
```shell
##更新注释
swag init


```
2 changes: 1 addition & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2019-04-18 17:26:23.9707556 +0800 CST m=+0.121648101
// 2019-05-16 10:45:30.7840849 +0800 CST m=+0.115740401

package docs

Expand Down
11 changes: 5 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ module github.com/hequan2017/go-admin
go 1.12

require (
github.com/Anderson-Lu/gofasion v0.0.0-20190311020154-5db4d09c9cb8
github.com/Unknwon/com v0.0.0-20190214221849-2d12a219ccaf
github.com/Anderson-Lu/gofasion v0.0.0-20190514022335-41a7982c9b5f
github.com/Unknwon/com v0.0.0-20190321035513-0fed4efef755
github.com/astaxie/beego v1.11.1
github.com/casbin/casbin v1.8.1
github.com/casbin/casbin v1.8.2
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/facebookgo/inject v0.0.0-20180706035515-f23751cae28b
github.com/facebookgo/structtag v0.0.0-20150214074306-217e25fb9691 // indirect
github.com/gin-gonic/gin v1.3.0
github.com/go-ini/ini v1.42.0
github.com/go-sql-driver/mysql v1.4.1
github.com/jinzhu/gorm v1.9.2
github.com/jinzhu/inflection v0.0.0-20180308033659-04140366298a // indirect
github.com/jinzhu/gorm v1.9.5
github.com/swaggo/gin-swagger v1.1.0
github.com/swaggo/swag v1.4.1
github.com/swaggo/swag v1.5.0
)
Loading

0 comments on commit b8c5895

Please sign in to comment.