Git Product home page Git Product logo

Comments (2)

juneyx avatar juneyx commented on June 14, 2024

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.

pixelmaxQm avatar pixelmaxQm commented on June 14, 2024

目前有无需配置的功能接口,已经自动化提供了。感谢 juneyx 给出解释

from gin-vue-admin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.