Documentation
¶
Index ¶
- Constants
- type Cookie
- type Ctx
- func (ctx *Ctx) Accepts(offers ...string) (offer string)
- func (ctx *Ctx) AcceptsCharsets(offers ...string) (offer string)
- func (ctx *Ctx) AcceptsEncodings(offers ...string) (offer string)
- func (ctx *Ctx) AcceptsLanguages(offers ...string) (offer string)
- func (ctx *Ctx) Append(field string, values ...string)
- func (ctx *Ctx) Attachment(name ...string)
- func (ctx *Ctx) BaseURL() string
- func (ctx *Ctx) Body(key ...string) string
- func (ctx *Ctx) BodyParser(out interface{}) error
- func (ctx *Ctx) ClearCookie(key ...string)
- func (ctx *Ctx) Cookie(cookie *Cookie)
- func (ctx *Ctx) Cookies(key ...string) (value string)
- func (ctx *Ctx) Download(file string, name ...string)
- func (ctx *Ctx) Error() error
- func (ctx *Ctx) FormFile(key string) (*multipart.FileHeader, error)
- func (ctx *Ctx) FormValue(key string) (value string)
- func (ctx *Ctx) Format(body interface{})
- func (ctx *Ctx) Fresh() bool
- func (ctx *Ctx) Get(key string) (value string)
- func (ctx *Ctx) Hostname() string
- func (ctx *Ctx) IP() string
- func (ctx *Ctx) IPs() []string
- func (ctx *Ctx) Is(extension string) (match bool)
- func (ctx *Ctx) JSON(json interface{}) error
- func (ctx *Ctx) JSONP(json interface{}, callback ...string) error
- func (ctx *Ctx) Links(link ...string)
- func (ctx *Ctx) Locals(key string, value ...interface{}) (val interface{})
- func (ctx *Ctx) Location(path string)
- func (ctx *Ctx) Method(override ...string) string
- func (ctx *Ctx) MultipartForm() (*multipart.Form, error)
- func (ctx *Ctx) Next(err ...error)
- func (ctx *Ctx) OriginalURL() string
- func (ctx *Ctx) Params(key string) (value string)
- func (ctx *Ctx) Path(override ...string) string
- func (ctx *Ctx) Protocol() string
- func (ctx *Ctx) Query(key string) (value string)
- func (ctx *Ctx) Range(size int) (rangeData Range, err error)
- func (ctx *Ctx) Redirect(path string, status ...int)
- func (ctx *Ctx) Render(file string, bind interface{}) error
- func (ctx *Ctx) Route() *Route
- func (ctx *Ctx) SaveFile(fileheader *multipart.FileHeader, path string) error
- func (ctx *Ctx) Secure() bool
- func (ctx *Ctx) Send(bodies ...interface{})
- func (ctx *Ctx) SendBytes(body []byte)
- func (ctx *Ctx) SendFile(file string, noCompression ...bool)
- func (ctx *Ctx) SendStatus(status int)
- func (ctx *Ctx) SendString(body string)
- func (ctx *Ctx) Set(key string, val string)
- func (ctx *Ctx) Stale() bool
- func (ctx *Ctx) Status(status int) *Ctx
- func (ctx *Ctx) Subdomains(offset ...int) []string
- func (ctx *Ctx) Type(ext string) *Ctx
- func (ctx *Ctx) Vary(fields ...string)
- func (ctx *Ctx) Write(bodies ...interface{})
- func (ctx *Ctx) XHR() bool
- type Fiber
- func (app *Fiber) All(path string, handlers ...func(*Ctx)) *Fiber
- func (app *Fiber) Connect(path string, handlers ...func(*Ctx)) *Fiber
- func (app *Fiber) Delete(path string, handlers ...func(*Ctx)) *Fiber
- func (app *Fiber) Get(path string, handlers ...func(*Ctx)) *Fiber
- func (app *Fiber) Group(prefix string, handlers ...func(*Ctx)) *Group
- func (app *Fiber) Head(path string, handlers ...func(*Ctx)) *Fiber
- func (app *Fiber) Listen(address interface{}, tlsconfig ...*tls.Config) error
- func (app *Fiber) Options(path string, handlers ...func(*Ctx)) *Fiber
- func (app *Fiber) Patch(path string, handlers ...func(*Ctx)) *Fiber
- func (app *Fiber) Post(path string, handlers ...func(*Ctx)) *Fiber
- func (app *Fiber) Put(path string, handlers ...func(*Ctx)) *Fiber
- func (app *Fiber) Shutdown() error
- func (app *Fiber) Static(prefix, root string, config ...Static) *Fiber
- func (app *Fiber) Test(request *http.Request, msTimeout ...int) (*http.Response, error)
- func (app *Fiber) Trace(path string, handlers ...func(*Ctx)) *Fiber
- func (app *Fiber) Use(args ...interface{}) *Fiber
- type Group
- func (grp *Group) All(path string, handlers ...func(*Ctx)) *Group
- func (grp *Group) Connect(path string, handlers ...func(*Ctx)) *Group
- func (grp *Group) Delete(path string, handlers ...func(*Ctx)) *Group
- func (grp *Group) Get(path string, handlers ...func(*Ctx)) *Group
- func (grp *Group) Group(prefix string, handlers ...func(*Ctx)) *Group
- func (grp *Group) Head(path string, handlers ...func(*Ctx)) *Group
- func (grp *Group) Options(path string, handlers ...func(*Ctx)) *Group
- func (grp *Group) Patch(path string, handlers ...func(*Ctx)) *Group
- func (grp *Group) Post(path string, handlers ...func(*Ctx)) *Group
- func (grp *Group) Put(path string, handlers ...func(*Ctx)) *Group
- func (grp *Group) Static(prefix, root string, config ...Static) *Group
- func (grp *Group) Trace(path string, handlers ...func(*Ctx)) *Group
- func (grp *Group) Use(args ...interface{}) *Group
- type Map
- type Range
- type Route
- type Settings
- type Static
Constants ¶
const ( MIMETextXML = "text/xml" MIMETextHTML = "text/html" MIMETextPlain = "text/plain" MIMEApplicationJSON = "application/json" MIMEApplicationJavaScript = "application/javascript" MIMEApplicationXML = "application/xml" MIMEApplicationForm = "application/x-www-form-urlencoded" MIMEMultipartForm = "multipart/form-data" MIMEOctetStream = "application/octet-stream" )
MIME types were copied from labstack/echo
const ( MethodGet = "GET" // RFC 7231, 4.3.1 MethodHead = "HEAD" // RFC 7231, 4.3.2 MethodPost = "POST" // RFC 7231, 4.3.3 MethodPut = "PUT" // RFC 7231, 4.3.4 MethodPatch = "PATCH" // RFC 5789 MethodDelete = "DELETE" // RFC 7231, 4.3.5 MethodConnect = "CONNECT" // RFC 7231, 4.3.6 MethodOptions = "OPTIONS" // RFC 7231, 4.3.7 MethodTrace = "TRACE" // RFC 7231, 4.3.8 )
HTTP methods were copied from net/http.
const ( // Authentication HeaderAuthorization = "Authorization" HeaderProxyAuthenticate = "Proxy-Authenticate" HeaderProxyAuthorization = "Proxy-Authorization" HeaderWWWAuthenticate = "WWW-Authenticate" // Caching HeaderAge = "Age" HeaderCacheControl = "Cache-Control" HeaderClearSiteData = "Clear-Site-Data" HeaderExpires = "Expires" HeaderPragma = "Pragma" HeaderWarning = "Warning" // Client hints HeaderAcceptCH = "Accept-CH" HeaderAcceptCHLifetime = "Accept-CH-Lifetime" HeaderContentDPR = "Content-DPR" HeaderDPR = "DPR" HeaderEarlyData = "Early-Data" HeaderSaveData = "Save-Data" HeaderViewportWidth = "Viewport-Width" HeaderWidth = "Width" // Conditionals HeaderETag = "ETag" HeaderIfMatch = "If-Match" HeaderIfModifiedSince = "If-Modified-Since" HeaderIfNoneMatch = "If-None-Match" HeaderIfUnmodifiedSince = "If-Unmodified-Since" HeaderLastModified = "Last-Modified" HeaderVary = "Vary" // Connection management HeaderConnection = "Connection" HeaderKeepAlive = "Keep-Alive" // Content negotiation HeaderAccept = "Accept" HeaderAcceptCharset = "Accept-Charset" HeaderAcceptEncoding = "Accept-Encoding" HeaderAcceptLanguage = "Accept-Language" // Controls HeaderCookie = "Cookie" HeaderExpect = "Expect" HeaderMaxForwards = "Max-Forwards" HeaderSetCookie = "Set-Cookie" // CORS HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials" HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers" HeaderAccessControlAllowMethods = "Access-Control-Allow-Methods" HeaderAccessControlAllowOrigin = "Access-Control-Allow-Origin" HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers" HeaderAccessControlMaxAge = "Access-Control-Max-Age" HeaderAccessControlRequestHeaders = "Access-Control-Request-Headers" HeaderAccessControlRequestMethod = "Access-Control-Request-Method" HeaderOrigin = "Origin" HeaderTimingAllowOrigin = "Timing-Allow-Origin" HeaderXPermittedCrossDomainPolicies = "X-Permitted-Cross-Domain-Policies" // Do Not Track HeaderDNT = "DNT" HeaderTk = "Tk" // Downloads HeaderContentDisposition = "Content-Disposition" // Message body information HeaderContentEncoding = "Content-Encoding" HeaderContentLanguage = "Content-Language" HeaderContentLength = "Content-Length" HeaderContentLocation = "Content-Location" HeaderContentType = "Content-Type" // Proxies HeaderForwarded = "Forwarded" HeaderVia = "Via" HeaderXForwardedFor = "X-Forwarded-For" HeaderXForwardedHost = "X-Forwarded-Host" HeaderXForwardedProto = "X-Forwarded-Proto" // Redirects HeaderLocation = "Location" // Request context HeaderFrom = "From" HeaderHost = "Host" HeaderReferer = "Referer" HeaderReferrerPolicy = "Referrer-Policy" HeaderUserAgent = "User-Agent" // Response context HeaderAllow = "Allow" HeaderServer = "Server" // Range requests HeaderAcceptRanges = "Accept-Ranges" HeaderContentRange = "Content-Range" HeaderIfRange = "If-Range" HeaderRange = "Range" // Security HeaderContentSecurityPolicy = "Content-Security-Policy" HeaderContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only" HeaderCrossOriginResourcePolicy = "Cross-Origin-Resource-Policy" HeaderExpectCT = "Expect-CT" HeaderFeaturePolicy = "Feature-Policy" HeaderPublicKeyPins = "Public-Key-Pins" HeaderPublicKeyPinsReportOnly = "Public-Key-Pins-Report-Only" HeaderStrictTransportSecurity = "Strict-Transport-Security" HeaderUpgradeInsecureRequests = "Upgrade-Insecure-Requests" HeaderXContentTypeOptions = "X-Content-Type-Options" HeaderXDownloadOptions = "X-Download-Options" HeaderXFrameOptions = "X-Frame-Options" HeaderXPoweredBy = "X-Powered-By" HeaderXXSSProtection = "X-XSS-Protection" // Server-sent event HeaderLastEventID = "Last-Event-ID" HeaderNEL = "NEL" HeaderPingFrom = "Ping-From" HeaderPingTo = "Ping-To" HeaderReportTo = "Report-To" // Transfer coding HeaderTE = "TE" HeaderTrailer = "Trailer" HeaderTransferEncoding = "Transfer-Encoding" // WebSockets HeaderSecWebSocketAccept = "Sec-WebSocket-Accept" HeaderSecWebSocketExtensions = "Sec-WebSocket-Extensions" HeaderSecWebSocketKey = "Sec-WebSocket-Key" HeaderSecWebSocketProtocol = "Sec-WebSocket-Protocol" HeaderSecWebSocketVersion = "Sec-WebSocket-Version" // Other HeaderAcceptPatch = "Accept-Patch" HeaderAcceptPushPolicy = "Accept-Push-Policy" HeaderAcceptSignature = "Accept-Signature" HeaderAltSvc = "Alt-Svc" HeaderDate = "Date" HeaderIndex = "Index" HeaderLargeAllocation = "Large-Allocation" HeaderLink = "Link" HeaderPushPolicy = "Push-Policy" HeaderRetryAfter = "Retry-After" HeaderServerTiming = "Server-Timing" HeaderSignature = "Signature" HeaderSignedHeaders = "Signed-Headers" HeaderSourceMap = "SourceMap" HeaderUpgrade = "Upgrade" HeaderXDNSPrefetchControl = "X-DNS-Prefetch-Control" HeaderXPingback = "X-Pingback" HeaderXRequestID = "X-Request-ID" HeaderXRequestedWith = "X-Requested-With" HeaderXRobotsTag = "X-Robots-Tag" HeaderXUACompatible = "X-UA-Compatible" )
HTTP Headers were copied from net/http.
const ( StatusContinue = 100 // RFC 7231, 6.2.1 StatusSwitchingProtocols = 101 // RFC 7231, 6.2.2 StatusProcessing = 102 // RFC 2518, 10.1 StatusOK = 200 // RFC 7231, 6.3.1 StatusCreated = 201 // RFC 7231, 6.3.2 StatusAccepted = 202 // RFC 7231, 6.3.3 StatusNonAuthoritativeInfo = 203 // RFC 7231, 6.3.4 StatusNoContent = 204 // RFC 7231, 6.3.5 StatusResetContent = 205 // RFC 7231, 6.3.6 StatusPartialContent = 206 // RFC 7233, 4.1 StatusMultiStatus = 207 // RFC 4918, 11.1 StatusAlreadyReported = 208 // RFC 5842, 7.1 StatusIMUsed = 226 // RFC 3229, 10.4.1 StatusMultipleChoices = 300 // RFC 7231, 6.4.1 StatusMovedPermanently = 301 // RFC 7231, 6.4.2 StatusFound = 302 // RFC 7231, 6.4.3 StatusSeeOther = 303 // RFC 7231, 6.4.4 StatusNotModified = 304 // RFC 7232, 4.1 StatusUseProxy = 305 // RFC 7231, 6.4.5 StatusTemporaryRedirect = 307 // RFC 7231, 6.4.7 StatusPermanentRedirect = 308 // RFC 7538, 3 StatusBadRequest = 400 // RFC 7231, 6.5.1 StatusPaymentRequired = 402 // RFC 7231, 6.5.2 StatusForbidden = 403 // RFC 7231, 6.5.3 StatusNotFound = 404 // RFC 7231, 6.5.4 StatusMethodNotAllowed = 405 // RFC 7231, 6.5.5 StatusNotAcceptable = 406 // RFC 7231, 6.5.6 StatusProxyAuthRequired = 407 // RFC 7235, 3.2 StatusRequestTimeout = 408 // RFC 7231, 6.5.7 StatusConflict = 409 // RFC 7231, 6.5.8 StatusGone = 410 // RFC 7231, 6.5.9 StatusLengthRequired = 411 // RFC 7231, 6.5.10 StatusPreconditionFailed = 412 // RFC 7232, 4.2 StatusRequestEntityTooLarge = 413 // RFC 7231, 6.5.11 StatusRequestURITooLong = 414 // RFC 7231, 6.5.12 StatusUnsupportedMediaType = 415 // RFC 7231, 6.5.13 StatusRequestedRangeNotSatisfiable = 416 // RFC 7233, 4.4 StatusExpectationFailed = 417 // RFC 7231, 6.5.14 StatusTeapot = 418 // RFC 7168, 2.3.3 StatusUnprocessableEntity = 422 // RFC 4918, 11.2 StatusLocked = 423 // RFC 4918, 11.3 StatusFailedDependency = 424 // RFC 4918, 11.4 StatusUpgradeRequired = 426 // RFC 7231, 6.5.15 StatusPreconditionRequired = 428 // RFC 6585, 3 StatusTooManyRequests = 429 // RFC 6585, 4 StatusRequestHeaderFieldsTooLarge = 431 // RFC 6585, 5 StatusInternalServerError = 500 // RFC 7231, 6.6.1 StatusNotImplemented = 501 // RFC 7231, 6.6.2 StatusBadGateway = 502 // RFC 7231, 6.6.3 StatusGatewayTimeout = 504 // RFC 7231, 6.6.5 StatusHTTPVersionNotSupported = 505 // RFC 7231, 6.6.6 StatusVariantAlsoNegotiates = 506 // RFC 2295, 8.1 StatusInsufficientStorage = 507 // RFC 4918, 11.5 StatusLoopDetected = 508 // RFC 5842, 7.2 StatusNotExtended = 510 // RFC 2774, 7 StatusNetworkAuthenticationRequired = 511 // RFC 6585, 6 )
HTTP status codes were copied from net/http.
const Version = "1.8.42"
Version of current package
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cookie ¶
type Cookie struct { Name string Value string Path string Domain string Expires time.Time Secure bool HTTPOnly bool SameSite string }
Cookie struct
type Ctx ¶
type Ctx struct { Fasthttp *fasthttp.RequestCtx // Reference to *fasthttp.RequestCtx // contains filtered or unexported fields }
Ctx represents the Context which hold the HTTP request and response. It has methods for the request query string, parameters, body, HTTP headers and so on.
func (*Ctx) AcceptsCharsets ¶
AcceptsCharsets checks if the specified charset is acceptable.
func (*Ctx) AcceptsEncodings ¶
AcceptsEncodings checks if the specified encoding is acceptable.
func (*Ctx) AcceptsLanguages ¶
AcceptsLanguages checks if the specified language is acceptable.
func (*Ctx) Append ¶
Append the specified value to the HTTP response header field. If the header is not already set, it creates the header with the specified value.
func (*Ctx) Attachment ¶
Attachment sets the HTTP response Content-Disposition header field to attachment.
func (*Ctx) Body ¶
Body contains the raw body submitted in a POST request. If a key is provided, it returns the form value
func (*Ctx) BodyParser ¶ added in v1.0.0
BodyParser binds the request body to a struct. It supports decoding the following content types based on the Content-Type header: application/json, application/xml, application/x-www-form-urlencoded, multipart/form-data
func (*Ctx) ClearCookie ¶
ClearCookie expires a specific cookie by key. If no key is provided it expires all cookies.
func (*Ctx) Download ¶
Download transfers the file from path as an attachment. Typically, browsers will prompt the user for download. By default, the Content-Disposition header filename= parameter is the filepath (this typically appears in the browser dialog). Override this default with the filename parameter.
func (*Ctx) Error ¶ added in v1.0.0
Error contains the error information passed via the Next(err) method.
func (*Ctx) FormFile ¶
func (ctx *Ctx) FormFile(key string) (*multipart.FileHeader, error)
FormFile returns the first file by key from a MultipartForm.
func (*Ctx) Format ¶
func (ctx *Ctx) Format(body interface{})
Format performs content-negotiation on the Accept HTTP header. It uses Accepts to select a proper format. If the header is not specified or there is no proper format, text/plain is used.
func (*Ctx) Get ¶
Get returns the HTTP request header specified by field. Field names are case-insensitive
func (*Ctx) IPs ¶ added in v1.0.0
IPs returns an string slice of IP addresses specified in the X-Forwarded-For request header.
func (*Ctx) Is ¶
Is returns the matching content type, if the incoming request’s Content-Type HTTP header field matches the MIME type specified by the type parameter
func (*Ctx) JSON ¶ added in v1.0.0
JSON converts any interface or string to JSON using Jsoniter. This method also sets the content header to application/json.
func (*Ctx) JSONP ¶ added in v1.0.0
JSONP sends a JSON response with JSONP support. This method is identical to JSON, except that it opts-in to JSONP callback support. By default, the callback name is simply callback.
func (*Ctx) Links ¶
Links joins the links followed by the property to populate the response’s Link HTTP header field.
func (*Ctx) Locals ¶
Locals makes it possible to pass interface{} values under string keys scoped to the request and therefore available to all following routes that match the request.
func (*Ctx) Location ¶
Location sets the response Location HTTP header to the specified path parameter.
func (*Ctx) Method ¶
Method contains a string corresponding to the HTTP method of the request: GET, POST, PUT and so on.
func (*Ctx) MultipartForm ¶
MultipartForm parse form entries from binary. This returns a map[string][]string, so given a key the value will be a string slice.
func (*Ctx) Next ¶
Next executes the next method in the stack that matches the current route. You can pass an optional error for custom error handling.
func (*Ctx) OriginalURL ¶ added in v1.0.0
OriginalURL contains the original request URL.
func (*Ctx) Params ¶
Params is used to get the route parameters. Defaults to empty string "", if the param doesn't exist.
func (*Ctx) Path ¶
Path returns the path part of the request URL. Optionally, you could override the path.
func (*Ctx) Protocol ¶
Protocol contains the request protocol string: http or https for TLS requests.
func (*Ctx) Redirect ¶
Redirect to the URL derived from the specified path, with specified status. If status is not specified, status defaults to 302 Found
func (*Ctx) Render ¶
Render a template with data and sends a text/html response. We support the following engines: html, amber, handlebars, mustache, pug
func (*Ctx) SaveFile ¶ added in v1.0.0
func (ctx *Ctx) SaveFile(fileheader *multipart.FileHeader, path string) error
SaveFile saves any multipart file to disk.
func (*Ctx) Secure ¶
Secure returns a boolean property, that is true, if a TLS connection is established.
func (*Ctx) Send ¶
func (ctx *Ctx) Send(bodies ...interface{})
Send sets the HTTP response body. The Send body can be of any type.
func (*Ctx) SendBytes ¶
SendBytes sets the HTTP response body for []byte types This means no type assertion, recommended for faster performance
func (*Ctx) SendFile ¶
SendFile transfers the file from the given path. The file is compressed by default Sets the Content-Type response HTTP header field based on the filenames extension.
func (*Ctx) SendStatus ¶
SendStatus sets the HTTP status code and if the response body is empty, it sets the correct status message in the body.
func (*Ctx) SendString ¶
SendString sets the HTTP response body for string types This means no type assertion, recommended for faster performance
func (*Ctx) Subdomains ¶
Subdomains returns a string slive of subdomains in the domain name of the request. The subdomain offset, which defaults to 2, is used for determining the beginning of the subdomain segments.
func (*Ctx) Type ¶
Type sets the Content-Type HTTP header to the MIME type specified by the file extension.
func (*Ctx) Vary ¶
Vary adds the given header field to the Vary response header. This will append the header, if not already listed, otherwise leaves it listed in the current location.
type Fiber ¶
type Fiber struct { Settings *Settings // Fiber settings // contains filtered or unexported fields }
Fiber denotes the Fiber application.
func New ¶
New creates a new Fiber named instance. You can pass optional settings when creating a new instance.
func (*Fiber) Group ¶ added in v1.4.2
Group is used for Routes with common prefix to define a new sub-router with optional middleware.
func (*Fiber) Listen ¶
Listen serves HTTP requests from the given addr or port. You can pass an optional *tls.Config to enable TLS.
func (*Fiber) Shutdown ¶ added in v1.4.1
Shutdown gracefully shuts down the server without interrupting any active connections. Shutdown works by first closing all open listeners and then waiting indefinitely for all connections to return to idle and then shut down.
When Shutdown is called, Serve, ListenAndServe, and ListenAndServeTLS immediately return nil. Make sure the program doesn't exit and waits instead for Shutdown to return.
Shutdown does not close keepalive connections so its recommended to set ReadTimeout to something else than 0.
func (*Fiber) Static ¶
Static registers a new route with path prefix to serve static files from the provided root directory.
func (*Fiber) Test ¶ added in v1.4.0
Test is used for internal debugging by passing a *http.Request. Timeout is optional and defaults to 200ms, -1 will disable it completely.
type Group ¶ added in v1.0.0
type Group struct {
// contains filtered or unexported fields
}
Group struct
func (*Group) Group ¶ added in v1.0.0
Group is used for Routes with common prefix to define a new sub-router with optional middleware.
type Map ¶ added in v1.0.0
type Map map[string]interface{}
Map is a shortcut for map[string]interface{}
type Route ¶ added in v1.0.0
type Route struct { Method string // http method Path string // orginal path Params []string // path params Regexp *regexp.Regexp // regexp matcher Handler func(*Ctx) // ctx handler // contains filtered or unexported fields }
Route struct
type Settings ¶ added in v1.0.0
type Settings struct { // This will spawn multiple Go processes listening on the same port Prefork bool // default: false // Enable strict routing. When enabled, the router treats "/foo" and "/foo/" as different. StrictRouting bool // default: false // Enable case sensitivity. When enabled, "/Foo" and "/foo" are different routes. CaseSensitive bool // default: false // Enables the "Server: value" HTTP header. ServerHeader string // default: "" // Enables handler values to be immutable even if you return from handler Immutable bool // default: false // Max body size that the server accepts BodyLimit int // default: 4 * 1024 * 1024 // Folder containing template files TemplateFolder string // default: "" // Template engine: html, amber, handlebars , mustache or pug TemplateEngine func(raw string, bind interface{}) (string, error) // default: nil // Extension for the template files TemplateExtension string // default: "" // The amount of time allowed to read the full request including body. ReadTimeout time.Duration // default: unlimited // The maximum duration before timing out writes of the response. WriteTimeout time.Duration // default: unlimited // The maximum amount of time to wait for the next request when keep-alive is enabled. IdleTimeout time.Duration // default: unlimited }
Settings holds is a struct holding the server settings
type Static ¶ added in v1.8.4
type Static struct { // Transparently compresses responses if set to true // This works differently than the github.com/gofiber/compression middleware // The server tries minimizing CPU usage by caching compressed files. // It adds ".fiber.gz" suffix to the original file name. // Optional. Default value false Compress bool // Enables byte range requests if set to true. // Optional. Default value false ByteRange bool // Enable directory browsing. // Optional. Default value false. Browse bool // Index file for serving a directory. // Optional. Default value "index.html". Index string }
Static struct