Skip to content

onetrue5200/RBAC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

casbin RBAC website demo

Build demo gin web server

package main

import "github.com/gin-gonic/gin"

func main() {
	r := gin.Default()
	r.GET("/ping", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"message": "pong",
		})
	})
	r.Run(":3000") // listen and serve on 0.0.0.0:8080
}

Build basic web server

package controllers

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

func Hello(c *gin.Context) {
	c.JSON(http.StatusOK, gin.H{
		"message": "hello",
	})
}
package routers

import (
	"rbac/controllers"

	"github.com/gin-gonic/gin"
)

func APIRouter(r *gin.Engine) {
	apiRouter := r.Group("/api")
	{
		apiRouter.GET("/", controllers.Hello)
	}
}
package main

import (
	"rbac/routers"

	"github.com/gin-gonic/gin"
)

func main() {
	r := gin.Default()

	routers.APIRouter(r)

	r.Run(":3000")
}

About

gin+casbin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published