router

package
v0.6.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTemplateFunctions added in v0.2.0

func LoadTemplateFunctions(engine *gin.Engine)

func LoadTemplates added in v0.3.8

func LoadTemplates(engine *gin.Engine) error

LoadTemplates loads html templates for use by the given engine

func SessionName added in v0.2.0

func SessionName() (string, error)

SessionName is a utility function that derives an appropriate session name from the hostname.

func SessionOptions added in v0.2.0

func SessionOptions() sessions.Options

SessionOptions returns the standard set of options to use for each session.

Types

type Router

type Router interface {
	// Attach a gin handler to the router with the given method and path
	AttachHandler(method string, path string, f gin.HandlerFunc)
	// Attach a gin middleware to the router that will be used globally
	AttachMiddleware(handler gin.HandlerFunc)
	// Attach 404 NoRoute handler
	AttachNoRouteHandler(handler gin.HandlerFunc)
	// Attach a router group, and receive that group back.
	// More middlewares and handlers can then be attached on
	// the group by the caller.
	AttachGroup(path string, handlers ...gin.HandlerFunc) *gin.RouterGroup
	// Start the router
	Start()
	// Stop the router
	Stop(ctx context.Context) error
}

Router provides the REST interface for gotosocial, using gin.

func New

func New(ctx context.Context, db db.DB) (Router, error)

New returns a new Router with the specified configuration.

The given DB is only used in the New function for parsing config values, and is not otherwise pinned to the router.

Jump to

Keyboard shortcuts

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