You've already forked golang-base-project
Improves documentation (#13)
* Documents all env variables and adds an example project * Adds godoc comments * Fixed package naming issue
This commit is contained in:
@ -6,8 +6,10 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// UserIDKey is the key used to set and get the user id in the context of the current request
|
||||
const UserIDKey = "UserID"
|
||||
|
||||
// Auth middleware redirects to /login and aborts the current request if there is no authenticated user
|
||||
func Auth() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
_, exists := c.Get(UserIDKey)
|
||||
|
Reference in New Issue
Block a user