handlers

package
v0.0.0-...-b1bf2c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreateAlert = "/create/alert"     //CreateAlert path for creating an alert
	GetAlerts   = "/get/alerts"       //GetAlerts path for getting all the alerts
	DeleteAlert = "/delete/alert/:id" //DeleteAlert path for deleting an alert
	GetToken    = "/get/token"        //GetToken path for getting a JWT token
)

Variables

This section is empty.

Functions

func JWTAuthentication

func JWTAuthentication() func(*gin.Context) error

This is the middleware function that will be used to protect routes with JWT authentication

func NewEndpoint

func NewEndpoint(app Application) *endpoint

func RegisterHTTPHandlers

func RegisterHTTPHandlers(e *gin.RouterGroup, app Application)

Types

type Application

type Application interface {
	CreateAlert(c *gin.Context) // CreateAlert implements Application to create an alert
	GetAlerts(c *gin.Context)   // GetAlerts implements Application to get all the alerts
	DeleteAlert(c *gin.Context) // DeleteAlert implements Application to delete an alert
	GetToken(c *gin.Context)    // GetToken implements Application to get a JWT token
}

func NewAppSvc

func NewAppSvc(store store.Store, logger *utils.Logger) Application

type Token

type Token struct {
	ID      string  `json:"id"`
	Expires float64 `json:"expires"`
}

func JWTAuthenticationVerify

func JWTAuthenticationVerify(c *gin.Context) (*Token, error)

This is the middleware function that will be used to verify if the current JWT token is valid or nott

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL