Documentation ¶
Index ¶
- Variables
- func All(path string, handlers ...func(*fiber.Ctx)) *fiber.App
- func Connect(path string, handlers ...func(*fiber.Ctx)) *fiber.App
- func CustomError(code int, path string) error
- func Delete(path string, handlers ...func(*fiber.Ctx)) *fiber.App
- func Get(path string, handlers ...func(*fiber.Ctx)) *fiber.App
- func GetDBO() *gorm.DB
- func GetFiber() *fiber.App
- func GetRegisteredApps() map[string]interface{}
- func GetView(prefix, name string) (*jet.Template, error)
- func Group(prefix string, handlers ...func(*fiber.Ctx)) *fiber.Group
- func GuessPath(file string) string
- func Head(path string, handlers ...func(*fiber.Ctx)) *fiber.App
- func InterceptOSSignal()
- func Options(path string, handlers ...func(*fiber.Ctx)) *fiber.App
- func Patch(path string, handlers ...func(*fiber.Ctx)) *fiber.App
- func Post(path string, handlers ...func(*fiber.Ctx)) *fiber.App
- func Put(path string, handlers ...func(*fiber.Ctx)) *fiber.App
- func Register(app App)
- func RegisterView(prefix, path string) *jet.Set
- func Run()
- func Setup()
- func Shutdown() error
- func Static(prefix, path string)
- func Trace(path string, handlers ...func(*fiber.Ctx)) *fiber.App
- func Use(args ...interface{}) *fiber.App
- type App
- type Configuration
- type Model
- type Request
- func (r *Request) Accepts(offers ...string) (offer string)
- func (r *Request) AcceptsCharsets(offers ...string) (offer string)
- func (r *Request) AcceptsEncodings(offers ...string) (offer string)
- func (r *Request) AcceptsLanguages(offers ...string) (offer string)
- func (r *Request) Append(field string, values ...string)
- func (r *Request) Attachment(name ...string)
- func (r *Request) BaseURL() string
- func (r *Request) Body(key ...string) string
- func (r *Request) BodyParser(out interface{}) error
- func (r *Request) ClearCookie(key ...string)
- func (r *Request) Cookie(cookie *fiber.Cookie)
- func (r *Request) Cookies(key ...string) (value string)
- func (r *Request) Download(file string, name ...string)
- func (r *Request) Error() error
- func (r *Request) Flash(params ...string)
- func (r *Request) FormFile(key string) (*multipart.FileHeader, error)
- func (r *Request) FormValue(key string) (value string)
- func (r *Request) Format(body interface{})
- func (r *Request) Fresh() bool
- func (r *Request) Get(key string) (value string)
- func (r Request) GetFlashes() []flash
- func (r *Request) HasError() bool
- func (r *Request) Hostname() string
- func (r *Request) IP() string
- func (r *Request) IPs() []string
- func (r *Request) Is(extension string) (match bool)
- func (r *Request) JSON(json interface{}) error
- func (r *Request) JSONP(json interface{}, callback ...string) error
- func (r *Request) Links(link ...string)
- func (r *Request) Locals(key string, value ...interface{}) (val interface{})
- func (r *Request) Location(path string)
- func (r *Request) Method(override ...string) string
- func (r *Request) MultipartForm() (*multipart.Form, error)
- func (r *Request) Next(err ...error)
- func (r *Request) OriginalURL() string
- func (r *Request) Params(key string) (value string)
- func (r *Request) Path(override ...string) string
- func (r *Request) Persist()
- func (r *Request) Protocol() string
- func (r *Request) Query(key string) (value string)
- func (r *Request) Range(size int) (rangeData fiber.Range, err error)
- func (r *Request) Redirect(path string, status ...int)
- func (r *Request) Render(file string, bind interface{}) error
- func (r *Request) RenderView(input interface{}, views ...string) *bytes.Buffer
- func (r *Request) Route() *fiber.Route
- func (r *Request) SaveFile(fileheader *multipart.FileHeader, path string) error
- func (r *Request) Secure() bool
- func (r *Request) Send(bodies ...interface{})
- func (r *Request) SendBytes(body []byte)
- func (r *Request) SendFile(file string, noCompression ...bool)
- func (r *Request) SendHTML(bodies ...interface{})
- func (r *Request) SendStatus(status int)
- func (r *Request) SendString(body string)
- func (r *Request) Set(key string, val string)
- func (r *Request) SetCookie(key string, val interface{}, params ...interface{})
- func (r *Request) SetError(err interface{})
- func (r *Request) Stale() bool
- func (r *Request) Status(status int) *Request
- func (r *Request) Subdomains(offset ...int) []string
- func (r *Request) Throw(e *e.Error)
- func (r *Request) Type(ext string) *Request
- func (r *Request) URL() *URL
- func (r *Request) Var(key string, value interface{})
- func (r *Request) Vary(fields ...string)
- func (r *Request) View(data interface{}, views ...string)
- func (r *Request) Write(bodies ...interface{})
- func (r *Request) WriteResponse(resp ...interface{})
- func (r *Request) XHR() bool
- type Response
- type URL
Constants ¶
This section is empty.
Variables ¶
var ( Events = event.New() StatusCodePages = map[int]string{} )
var AppMenus = []menu.Menu{}
var Arg args
var Database *gorm.DB
var DefaultPath = map[string][]string{}
var Exec string
var OS = struct { Name string Version string Kernel string Username string Path struct { Bin []string Home string Root string Tmp string AppData []string } }{}
var ProcessID int
var WorkingDir string
Functions ¶
func CustomError ¶
CustomError set custom page for errors
func GetRegisteredApps ¶
func GetRegisteredApps() map[string]interface{}
GetRegisteredApps return list of registered apps
func Group ¶
Group is used for Routes with common prefix to define a new sub-router with optional middleware.
func RegisterView ¶
RegisterView register views of given path
func Shutdown ¶
func Shutdown() error
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.
Types ¶
type App ¶
type App interface { Register() Router() WhenReady() Permissions() []user.Permission Menus() []menu.Menu }
type Configuration ¶
type Configuration struct { App struct { Name string `yaml:"name"` Static string `yaml:"static"` SessionAge int `yaml:"session-age"` Language string `yaml:"language"` StrongPass int `yaml:"strong-pass-level"` } `yaml:"app"` JWT struct { Secret string `yaml:"secret"` Issuer string `yaml:"issuer"` Audience []string `yaml:"audience"` Age time.Duration `yaml:"age"` Subject string `yaml:"subject"` AgeString string `yaml:"age"` } `yaml:"jwt"` Server struct { Host string `yaml:"host"` Port string `yaml:"port"` Cert string `yaml:"cert"` Key string `yaml:"key"` HTTPS bool `yaml:"https"` Name string `yaml:"name"` MaxUploadSize string `yaml:"max-upload-size"` StrictRouting bool `yaml:"strict-routing"` CaseSensitive bool `yaml:"case-sensitive"` RequestID bool `yaml:"request-id"` Debug bool `yaml:"debug"` Recover bool `yaml:"recover"` } `yaml:"server"` Database struct { Enabled bool `yaml:"enabled"` Type string `yaml:"type"` Username string `yaml:"user"` Password string `yaml:"pass"` Server string `yaml:"server"` Cache string `yaml:"cache"` CacheSize string `yaml:"cache-size"` Debug string `yaml:"debug"` Database string `yaml:"database"` SSLMode string `yaml:"ssl-mode"` Params string `yaml:"params"` MaxOpenConns int `yaml:"max-open-connections"` MaxIdleConns int `yaml:"max-idle-connections"` ConnMaxLifTime time.Duration `yaml:"connection-max-lifetime"` } `yaml:"database"` Tweaks struct { Ballast bool `yaml:"ballast"` BallastSize string `yaml:"ballast-size"` MaxProcessors int `yaml:"processors"` PreFork bool `yaml:"prefork"` } `yaml:"tweaks"` RateLimit struct { Enabled bool `yaml:"enabled"` Duration int `yaml:"duration"` Requests int `yaml:"requests"` } `yaml:"ratelimit"` CORS struct { Enabled bool `yaml:"enabled"` AllowOrigins []string `yaml:"allowed-origins"` AllowMethods []string `yaml:"allowed-methods"` AllowHeaders []string `yaml:"allowed-headers"` AllowCredentials bool `yaml:"allowed-credentials"` MaxAge int `yaml:"requests"` } `yaml:"cors"` }
type Request ¶
type Request struct { Variables fiber.Map Context *fiber.Ctx JWT *jwt.Payload User *user.User Response Response // contains filtered or unexported fields }
func (*Request) Accepts ¶
Accepts checks if the specified extensions or content types are acceptable.
func (*Request) AcceptsCharsets ¶
AcceptsCharsets checks if the specified charset is acceptable.
func (*Request) AcceptsEncodings ¶
AcceptsEncodings checks if the specified encoding is acceptable.
func (*Request) AcceptsLanguages ¶
AcceptsLanguages checks if the specified language is acceptable.
func (*Request) 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 (*Request) Attachment ¶
Attachment sets the HTTP response Content-Disposition header field to attachment.
func (*Request) Body ¶
Body contains the raw body submitted in a POST request. If a key is provided, it returns the form value
func (*Request) BodyParser ¶
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 (*Request) ClearCookie ¶
ClearCookie expires a specific cookie by key. If no key is provided it expires all cookies.
func (*Request) 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 (*Request) FormFile ¶
func (r *Request) FormFile(key string) (*multipart.FileHeader, error)
FormFile returns the first file by key from a MultipartForm.
func (*Request) Format ¶
func (r *Request) 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 (*Request) Get ¶
Get returns the HTTP request header specified by field. Field names are case-insensitive
func (Request) GetFlashes ¶
func (r Request) GetFlashes() []flash
func (*Request) IPs ¶
IPs returns an string slice of IP addresses specified in the X-Forwarded-For request header.
func (*Request) 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 (*Request) JSON ¶
JSON converts any interface or string to JSON using Jsoniter. This method also sets the content header to application/json.
func (*Request) JSONP ¶
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 (*Request) Links ¶
Links joins the links followed by the property to populate the response’s Link HTTP header field.
func (*Request) 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 (*Request) Location ¶
Location sets the response Location HTTP header to the specified path parameter.
func (*Request) Method ¶
Method contains a string corresponding to the HTTP method of the request: GET, POST, PUT and so on.
func (*Request) 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 (*Request) 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 (*Request) OriginalURL ¶
OriginalURL contains the original request URL.
func (*Request) Params ¶
Params is used to get the route parameters. Defaults to empty string "", if the param doesn't exist.
func (*Request) Path ¶
Path returns the path part of the request URL. Optionally, you could override the path.
func (*Request) Protocol ¶
Protocol contains the request protocol string: http or https for TLS requests.
func (*Request) Redirect ¶
Redirect to the URL derived from the specified path, with specified status. If status is not specified, status defaults to 302 Found
func (*Request) Render ¶
Render a template with data and sends a text/html response. We support the following engines: html, amber, handlebars, mustache, pug
func (*Request) RenderView ¶
func (*Request) SaveFile ¶
func (r *Request) SaveFile(fileheader *multipart.FileHeader, path string) error
SaveFile saves any multipart file to disk.
func (*Request) Secure ¶
Secure returns a boolean property, that is true, if a TLS connection is established.
func (*Request) Send ¶
func (r *Request) Send(bodies ...interface{})
Send sets the HTTP response body. The Send body can be of any type.
func (*Request) SendBytes ¶
SendBytes sets the HTTP response body for []byte types This means no type assertion, recommended for faster performance
func (*Request) 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 (*Request) SendHTML ¶
func (r *Request) SendHTML(bodies ...interface{})
Send sets the HTML response body. The Send body can be of any type.
func (*Request) SendStatus ¶
SendStatus sets the HTTP status code and if the response body is empty, it sets the correct status message in the body.
func (*Request) SendString ¶
SendString sets the HTTP response body for string types This means no type assertion, recommended for faster performance
func (*Request) SetCookie ¶
SetCookie set cookie with given name,value and optional params (wise function)
func (*Request) 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 (*Request) Type ¶
Type sets the Content-Type HTTP header to the MIME type specified by the file extension.
func (*Request) 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.
func (*Request) Write ¶
func (r *Request) Write(bodies ...interface{})
Write appends any input to the HTTP body response.
func (*Request) WriteResponse ¶
func (r *Request) WriteResponse(resp ...interface{})
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
apps
|
|
examples
|
|
tools/gaper
Package gaper implements a supervisor restarts a go project when it crashes or a watched file changes
|
Package gaper implements a supervisor restarts a go project when it crashes or a watched file changes |