Documentation
¶
Index ¶
- Constants
- func AddAdditionalRoutes(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gin.Engine
- func AddHealthCheckRoutes(r *gin.Engine) *gin.Engine
- func AddMessageRoutes(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gin.Engine
- func AddUserRoutes(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gin.Engine
- func GetAuthMiddleware() (*jwt.GinJWTMiddleware, error)
- func GetIDFromClaim(c *gin.Context) int
- func GetSessionTokenFromClaim(c *gin.Context) string
- func HandleHealthCheckRequest(c *gin.Context)
- func HandleMessageCreateRequest(c *gin.Context)
- func HandleMessagesRequest(c *gin.Context)
- func HandleUserCreateRequest(c *gin.Context)
- func InitRouter() *gin.Engine
- func ReplyBadRequest(c *gin.Context, msg string)
- func ReplyForbidden(c *gin.Context, msg string)
- func ReplyInternalServerError(c *gin.Context, msg string)
- func ReplyNotFound(c *gin.Context, msg string)
- func ReplyUnprocessableEntity(c *gin.Context, msg string)
- func SetCrossOrigin(r *gin.Engine) *gin.Engine
- func ValidatePassword(plain_password string) bool
Constants ¶
View Source
const ( // The user identity key for JWT middleware KEY_USERID = "userid" APIHealthCheckRoute string = "/check" LoginRoute string = "/login" // Identifiers for the user in claims/context USER_ID_KEY string = "id" USER_SESSION_TOKEN string = "sessiontoken" // For identifying the content type in Content-Type header ContentTypeJSON string = "application/json; charset=utf-8" )
View Source
const ( MessageRoute string = "/message" MessagesRoute string = "/messages" )
View Source
const ( UserRoute string = "/user" UsersRoute string = "/users" )
Variables ¶
This section is empty.
Functions ¶
func AddAdditionalRoutes ¶
func AddMessageRoutes ¶
func AddUserRoutes ¶
func GetAuthMiddleware ¶
func GetAuthMiddleware() (*jwt.GinJWTMiddleware, error)
func GetIDFromClaim ¶
Get the user ID from the claim in the JWT
func GetSessionTokenFromClaim ¶
Get the session token from the claim in the JWT
func HandleMessagesRequest ¶
func HandleUserCreateRequest ¶
func ReplyBadRequest ¶
func ReplyForbidden ¶
func ReplyNotFound ¶
func ReplyUnprocessableEntity ¶
USES:
- The payload was correctly formed, but could not be marshalled into the JSON struct
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.