routes

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MethodDelete = "DELETE"
View Source
var MethodGet = "GET"
View Source
var MethodOptions = "OPTIONS"
View Source
var MethodPatch = "PATCH"
View Source
var MethodPost = "POST"
View Source
var MethodPut = "PUT"

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func NewApp

func NewApp(config *Config) *App

func (*App) AddApp

func (a *App) AddApp(routeInterface Interface)

func (*App) Listen

func (a *App) Listen(host string, port int) error

type Base

type Base struct {
	Auth   *auth.Auth
	Logger *logger.Logger
	Prefix string
	// contains filtered or unexported fields
}

func (*Base) AddRoute

func (ctrl *Base) AddRoute(route *Route)

func (*Base) GetIdParams

func (ctrl *Base) GetIdParams(c *fiber.Ctx, key string) (primitive.ObjectID, *gerror.Error)

func (*Base) GetParams

func (ctrl *Base) GetParams(c *fiber.Ctx, key string) (string, *gerror.Error)

func (*Base) GetToken

func (ctrl *Base) GetToken(ctx *fiber.Ctx) string

func (*Base) GetUser

func (ctrl *Base) GetUser(ctx *fiber.Ctx) jwt.Claims

func (*Base) Routes

func (ctrl *Base) Routes(app *fiber.App)

type Config

type Config struct {
}

func NewConfig

func NewConfig() *Config

type Interface

type Interface interface {
	Routes(app *fiber.App)
	AddRoute(route *Route)
}

type Route

type Route struct {
	Path    string
	Method  string
	Handler fiber.Handler
	Role    []string
	Auth    bool
	Static  bool
	Log     bool
}

func Delete

func Delete(path string, handler fiber.Handler, auth bool, roles ...string) *Route

func Get

func Get(path string, handler fiber.Handler, auth bool, roles ...string) *Route

func Post

func Post(path string, handler fiber.Handler, auth bool, roles ...string) *Route

func Put

func Put(path string, handler fiber.Handler, auth bool, roles ...string) *Route

func Static

func Static(path string, handler fiber.Handler) Route

Jump to

Keyboard shortcuts

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