handler

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AssetsPrefix is a prefix that is appended to the ResourcesDir to get the base path for all assets
	// This is used by the provided AssetsHandler implementation to serve files from
	AssetsPrefix = "/assets/"
)

Functions

func Assets

func Assets(ctx mojito.Context) error

Assets will return a handler that can serve assets on a given path. AssetsHandler will look for the assets as ResourcesDir + AssetsPrefix on the file system. The path provided must be the same path as registered on the router. Make sure the path you register this handler on ends with the wildcard route parameter "path"! Example: "/assets/*path"

func HandleAssets

func HandleAssets() error

HandleAssets will register the AssetsHandler on the default router

func HandleAssetsOn

func HandleAssetsOn(path string) error

HandleAssetsOnPath will register the AssetsHandler on the default router and a given path with the correct route param suffix

func PermanentRedirect

func PermanentRedirect(url string) func(ctx mojito.Context)

PermanentRedirect will take incoming requests and redirect them to the given URL with a 301 - Permanently moved status code

func Redirect

func Redirect(url string) func(ctx mojito.Context)

Redirect will take incoming requests and redirect them to the given URL with a 302 - Temporarily moved status code

func View

func View(view string) func(ctx mojito.RendererContext) error

View will server a given template using the default rendering engine without any view bag contents

func ViewWithBag

func ViewWithBag(view string, callback func(bag renderer.ViewBag)) func(ctx mojito.RendererContext) error

View will server a given template using the default rendering engine and provides the option to modify the viewbag in a callback function

Types

This section is empty.

Jump to

Keyboard shortcuts

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