Documentation
¶
Index ¶
Constants ¶
View Source
const (
Version = "under development"
)
Variables ¶
This section is empty.
Functions ¶
func RegisterHelper ¶ added in v0.3.1
func RegisterHelper(pattern, regex string)
Use to register global helper pattern to be use in param matching example : ip ,`\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}` then you can use something like v.Get("/location/:ip", ...)
func TestMatcher ¶ added in v0.3.2
func TestMatcher(expect bool, pattern string, tests ...map[TestUrl]ExpectMatch) []error
Can be use to validate whether the regex pattern match correctly
Types ¶
type Config ¶ added in v0.3.0
type Config struct { // When set to false , this will turn off the banner Banner bool // Set the custom not found error handler , if not set the default not fault will be use NotFoundHandler http.HandlerFunc }
Configuration for vi instance
type ExpectMatch ¶ added in v0.3.2
Expect test result , for each param expect value in TestMatcher
type StaticConfig ¶ added in v0.4.0
type StaticConfig struct { // Root is a filesystem that provides access to a // collection of files and directories , use http.Dir("folder name") or embed FS with http.FS() // Required Root http.FileSystem // Defines prefix that will be add to be when reading a file from FileSystem // Use only when using go embed FS for Root // Optional default to "" Prefix string // Name of the index file for serving // Optional default to index.html Index string // The value for the cache-control HTTP-Header when response , its define in term of second , default value to 0 // Optional default to 0 MaxAge int // Next defines a function that allow to skip a scenario when it return true // Optional default to nil Next func(w http.ResponseWriter, r *http.Request) bool // File to return if path is not found. Useful for SPA's // Optional default to 404 not found NotFoundFile string }
Static defines configuration options when defining static route
Click to show internal directories.
Click to hide internal directories.