Comments (2)
在router/{package_name}/{struct_name}.go
中可以按需配置接口白名单
比如说demo包中有个功能模块叫demo1,那就编辑router/demo/demo1.go
// InitDemo1Router 初始化demo1表 路由信息
func (s *DemoRouter) InitDemo1Router(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
demo1Router := Router.Group("demo1").Use(middleware.OperationRecord())
demo1RouterWithoutRecord := Router.Group("demo1")
demo1RouterWithoutAuth := PublicRouter.Group("demo1")
// 将接口逻辑提前在Demo1Api中写好
var demo1Api = v1.ApiGroupApp.DemoApiGroup.Demo1Api
{
// 通过demo1Route绑定需要记录操作日志的接口
demo1Router.POST("create", demo1Api.Create)
demo1Router.DELETE("delete", demo1Api.Delete)
demo1Router.DELETE("deleteByIds", demo1Api.DeleteByIds)
demo1Router.PUT("update", demo1Api.Update)
}
{
// 通过demo1RouterWithoutRecord绑定不需要记录日志的接口
demo1RouterWithoutRecord.GET("find", demo1Api.Find)
demo1RouterWithoutRecord.GET("getList", demo1Api.GetList)
}
{
// 通过demo1RouterWithoutAuth绑定不需要鉴权的接口(即白名单接口)
demo1RouterWithoutAuth.GET("getPublic", demo1Api.GetPublic)
demo1RouterWithoutAuth.POST("whitePost", demo1Api.PostData)
demo1RouterWithoutAuth.GET("whiteGet", demo1Api.GetData)
}
}
from gin-vue-admin.
目前有无需配置的功能接口,已经自动化提供了。感谢 juneyx 给出解释
from gin-vue-admin.
Related Issues (20)
- [Bug]: 删除菜单: ERROR: table name "sys_base_menus" specified more than once (SQLSTATE 42712)
- [Bug]: 修改/新增菜单选根目录时提示`ParentId值不能为空`
- [Bug]: (Postgresql) 修改角色、用户、字典更新报错
- [Feature]: Model字符字段增加gorm size tag
- [Bug]: 媒体库上传图片回显404 HOT 7
- [Bug]: DisableForeignKeyConstraintWhenMigrating为true时角色表会创建失败 HOT 2
- [Bug]: 菜单每隔一次出现错误, HOT 4
- [Feature]: 工作流功能申请 HOT 1
- [Bug]: table.vue.tpl getDetails方法没有定义 HOT 2
- [Bug]: 枚举为空报错
- [Bug]: switch样式失效
- 富文本报错 HOT 1
- Casbin 权限问题 [Bug]: HOT 2
- [Feature]: 水印功能不够完善 HOT 1
- [Bug]: 使用了未定义方法 HOT 1
- [Bug]: 超级管理员-用户管理-编辑当前用户头像成功后,没有更新右上角账号头像 HOT 1
- [Bug]: 【超级管理员-用户管理】用户头像错乱的bug HOT 2
- [Feature]: 是否可以使用vxe-table替换el-table HOT 4
- [Feature]: 建议切换角色就直接跳转到该角色的首页
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gin-vue-admin.