router

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: AGPL-3.0 Imports: 20 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 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)
	// Add Gin StaticFile handler
	AttachStaticFS(relativePath string, fs http.FileSystem)
	// 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