diff --git a/README_CH.md b/.github/README_CH.md similarity index 88% rename from README_CH.md rename to .github/README_CH.md index ea1467aaa4..7fc8632508 100644 --- a/README_CH.md +++ b/.github/README_CH.md @@ -1,4 +1,4 @@ -# πŸš€ Fiber en ru +# πŸš€ Fiber en ru [![](https://img.shields.io/github/release/gofiber/fiber)](https://github.com/gofiber/fiber/releases) ![](https://img.shields.io/github/languages/top/gofiber/fiber) [![](https://godoc.org/github.com/gofiber/fiber?status.svg)](https://godoc.org/github.com/gofiber/fiber) ![](https://goreportcard.com/badge/github.com/gofiber/fiber) [![GitHub license](https://img.shields.io/github/license/gofiber/fiber.svg)](https://github.com/gofiber/fiber/blob/master/LICENSE) [![Join the chat at https://gitter.im/gofiber/community](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gofiber/community) @@ -14,7 +14,7 @@ ## Benchmark -[![](https://fiber.wiki/static/benchmarks/benchmark.png)](https://fiber.wiki/#/benchmarks) +[![](https://github.com/gofiber/docs/blob/master/static/benchmarks/benchmark.png)](https://fiber.wiki/benchmarks) πŸ‘‰ **[η‚Ήε‡»θΏ™ι‡Œ](https://fiber.wiki/#/benchmarks)** ζŸ₯ηœ‹ζ‰€ζœ‰εŸΊε‡†ζ΅‹θ―•η»“ζžœ. @@ -73,7 +73,7 @@ go run server.go ## Static files -θ¦ζδΎ›ι™ζ€ζ–‡δ»ΆοΌŒθ―·δ½Ώη”¨ [Static](https://fiber.wiki/#/?id=static-files) 方法: +θ¦ζδΎ›ι™ζ€ζ–‡δ»ΆοΌŒθ―·δ½Ώη”¨ [Static](https://fiber.wiki/application#static) 方法: ```go package main diff --git a/README_NEW.md b/.github/README_NEW.md similarity index 84% rename from README_NEW.md rename to .github/README_NEW.md index c890fb4845..d2471628c2 100644 --- a/README_NEW.md +++ b/.github/README_NEW.md @@ -1,6 +1,6 @@ Fiber logo -# πŸš€ Fiber ru ch +# πŸš€ Fiber ru ch [![](https://img.shields.io/github/release/gofiber/fiber)](https://github.com/gofiber/fiber/releases) ![](https://img.shields.io/github/languages/top/gofiber/fiber) [![](https://godoc.org/github.com/gofiber/fiber?status.svg)](https://godoc.org/github.com/gofiber/fiber) ![](https://goreportcard.com/badge/github.com/gofiber/fiber) [![GitHub license](https://img.shields.io/github/license/gofiber/fiber.svg)](https://github.com/gofiber/fiber/blob/master/LICENSE) [![Join the chat at https://gitter.im/gofiber/community](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gofiber/community) @@ -41,27 +41,27 @@ go get github.com/gofiber/fiber ## πŸ€– Benchmarks -These tests are performed by [TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks) and [Go Web](https://github.com/smallnest/go-web-framework-benchmark). If you want to see all results, please visit our [Wiki](https://fiber.wiki/#benchmarks). +These tests are performed by [TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks) and [Go Web](https://github.com/smallnest/go-web-framework-benchmark). If you want to see all results, please visit our [Wiki](https://fiber.wiki/benchmarks).

- - + +

## 🎯 Main features -- Robust [routing](https://fiber.wiki/#/routing) -- Serve [static files](https://fiber.wiki/#/application?id=static) -- [Extreme performance](https://fiber.wiki/#/benchmarks) +- Robust [routing](https://fiber.wiki/routing) +- Serve [static files](https://fiber.wiki/application#static) +- [Extreme performance](https://fiber.wiki/benchmarks) - Low memory footprint -- Express [API endpoints](https://fiber.wiki/#/context) -- Middleware & [Next](https://fiber.wiki/#context?id=next) support +- Express [API endpoints](https://fiber.wiki/context) +- Middleware & [Next](https://fiber.wiki/context#next) support - Rapid server-side programming - And much more, [visit our Wiki](https://fiber.wiki/) ## πŸ’‘ Philosophy -People switching from [Node.js](https://nodejs.org/en/about/) to [Go](https://golang.org/doc/) often don't understand how to start building their web applications or microservices. Fiber, as a **web framework**, was created with the idea of **minimalism** and follow **UNIX way**, so that newbie gophers can quickly enter the new world of Go, but be in it like home. +People switching from [Node.js](https://nodejs.org/en/about/) to [Go](https://golang.org/doc/) having a heard time on how to start building their web applications or microservices. Fiber, as a **web framework**, was created with the idea of **minimalism** and follow **UNIX way**, so that new gophers can quickly enter the world of Go, but with a warm welcome. Fiber is **inspired** by the Express framework, the most popular web framework on Internet. We combined the **ease** of Express and **raw performance** of Go. If you have ever implemented a web application on Node.js (_using Express.js or similar_), then many methods and principles will seem **very common** to you. diff --git a/README_RU.md b/.github/README_RU.md similarity index 91% rename from README_RU.md rename to .github/README_RU.md index 79dceb4a34..741553c021 100644 --- a/README_RU.md +++ b/.github/README_RU.md @@ -1,4 +1,4 @@ -# πŸš€ Fiber en ch +# πŸš€ Fiber en ch [![](https://img.shields.io/github/release/gofiber/fiber)](https://github.com/gofiber/fiber/releases) ![](https://img.shields.io/github/languages/top/gofiber/fiber) [![](https://godoc.org/github.com/gofiber/fiber?status.svg)](https://godoc.org/github.com/gofiber/fiber) ![](https://goreportcard.com/badge/github.com/gofiber/fiber) [![GitHub license](https://img.shields.io/github/license/gofiber/fiber.svg)](https://github.com/gofiber/fiber/blob/master/LICENSE) [![Join the chat at https://gitter.im/gofiber/community](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gofiber/community) @@ -14,9 +14,9 @@ ## Π‘Π΅Π½Ρ‡ΠΌΠ°Ρ€ΠΊ -[![](https://fiber.wiki/static/benchmarks/benchmark.png)](https://fiber.wiki/#/benchmarks) +[![](https://github.com/gofiber/docs/blob/master/static/benchmarks/benchmark.png)](https://fiber.wiki/benchmarks) -πŸ‘‰ **[Click here](https://fiber.wiki/#/benchmarks)** to see all benchmark results. +πŸ‘‰ **[Click here](https://fiber.wiki/benchmarks)** to see all benchmark results. ## ΠžΡΠΎΠ±Π΅Π½Π½ΠΎΡΡ‚ΠΈ @@ -73,7 +73,7 @@ go run server.go ## Π‘Ρ‚Π°Ρ‚ΠΈΡ‡Π½Ρ‹Π΅ Ρ„Π°ΠΉΠ»Ρ‹ -Для получСния доступа ΠΊ статичным Ρ„Π°ΠΉΠ»Π°ΠΌ, ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠΉΡ‚Π΅ ΠΌΠ΅Ρ‚ΠΎΠ΄ [Static](https://fiber.wiki/#/?id=static-files): +Для получСния доступа ΠΊ статичным Ρ„Π°ΠΉΠ»Π°ΠΌ, ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠΉΡ‚Π΅ ΠΌΠ΅Ρ‚ΠΎΠ΄ [Static](https://fiber.wiki/application#static): ```go package main diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000000..f1e44ef146 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,2 @@ +tasks: + - init: go get && go build ./... && go test ./... diff --git a/README.md b/README.md index a8fb44a7ea..99dc61ed00 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -# πŸš€ Fiber ru ch -[![](https://img.shields.io/github/release/gofiber/fiber)](https://github.com/gofiber/fiber/releases) ![](https://img.shields.io/github/languages/top/gofiber/fiber) [![](https://godoc.org/github.com/gofiber/fiber?status.svg)](https://godoc.org/github.com/gofiber/fiber) ![](https://goreportcard.com/badge/github.com/gofiber/fiber) [![GitHub license](https://img.shields.io/github/license/gofiber/fiber.svg)](https://github.com/gofiber/fiber/blob/master/LICENSE) [![Join the chat at https://gitter.im/gofiber/community](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gofiber/community) +# πŸš€ Fiber ru ch + +[![](https://img.shields.io/github/release/gofiber/fiber)](https://github.com/gofiber/fiber/releases) ![](https://img.shields.io/github/languages/top/gofiber/fiber) [![](https://godoc.org/github.com/gofiber/fiber?status.svg)](https://godoc.org/github.com/gofiber/fiber) ![](https://goreportcard.com/badge/github.com/gofiber/fiber) [![GitHub license](https://img.shields.io/github/license/gofiber/fiber.svg)](https://github.com/gofiber/fiber/blob/master/LICENSE) [![Join the chat at https://gitter.im/gofiber/community](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gofiber/community) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/gofiber/fiber) Fiber logo @@ -14,9 +15,9 @@ People switching from [Node.js](https://nodejs.org/en/about/) to [Go](https://go ## Benchmark -[![](https://fiber.wiki/static/benchmarks/benchmark.png)](https://fiber.wiki/#/benchmarks) +[![](https://github.com/gofiber/docs/blob/master/static/benchmarks/benchmark.png)](https://fiber.wiki/benchmarks) -πŸ‘‰ **[Click here](https://fiber.wiki/#/benchmarks)** to see all benchmark results. +πŸ‘‰ **[Click here](https://fiber.wiki/benchmarks)** to see all benchmark results. ## Features @@ -73,7 +74,7 @@ And now, browse to `http://localhost:8080` and you should see `Hello, World!` on ## Static files -To serve static files, use the [Static](https://fiber.wiki/#/?id=static-files) method: +To serve static files, use the [Static](https://fiber.wiki/application#static) method: ```go package main diff --git a/application.go b/application.go index eb198c2e44..2967eb2b4a 100644 --- a/application.go +++ b/application.go @@ -1,9 +1,9 @@ -// πŸ”Œ Fiber is an Express.js inspired web framework build on πŸš€ Fasthttp. +// πŸš€ Fiber is an Express.js inspired web framework written in Go with πŸ’– // πŸ“Œ Please open an issue if you got suggestions or found a bug! -// πŸ–₯ https://github.com/gofiber/fiber +// πŸ–₯ Links: https://github.com/gofiber/fiber, https://fiber.wiki // 🦸 Not all heroes wear capes, thank you to some amazing people -// πŸ’– @valyala, @dgrr, @erikdubbelboer, @savsgio, @julienschmidt +// πŸ’– @valyala, @erikdubbelboer, @savsgio, @julienschmidt, @koddr package fiber @@ -71,7 +71,7 @@ type engine struct { KeepHijackedConns bool } -// New creates a Fiber instance +// New https://fiber.wiki/application#new func New() *Fiber { flag.Parse() return &Fiber{ diff --git a/context.go b/context.go index 879f2610f8..0f7428e69b 100644 --- a/context.go +++ b/context.go @@ -1,9 +1,9 @@ -// πŸ”Œ Fiber is an Express.js inspired web framework build on πŸš€ Fasthttp. +// πŸš€ Fiber is an Express.js inspired web framework written in Go with πŸ’– // πŸ“Œ Please open an issue if you got suggestions or found a bug! -// πŸ–₯ https://github.com/gofiber/fiber +// πŸ–₯ Links: https://github.com/gofiber/fiber, https://fiber.wiki // 🦸 Not all heroes wear capes, thank you to some amazing people -// πŸ’– @valyala, @dgrr, @erikdubbelboer, @savsgio, @julienschmidt +// πŸ’– @valyala, @erikdubbelboer, @savsgio, @julienschmidt, @koddr package fiber diff --git a/listen.go b/listen.go index b4867c4f08..2f886b1b7c 100644 --- a/listen.go +++ b/listen.go @@ -1,9 +1,9 @@ -// πŸ”Œ Fiber is an Express.js inspired web framework build on πŸš€ Fasthttp. +// πŸš€ Fiber is an Express.js inspired web framework written in Go with πŸ’– // πŸ“Œ Please open an issue if you got suggestions or found a bug! -// πŸ–₯ https://github.com/gofiber/fiber +// πŸ–₯ Links: https://github.com/gofiber/fiber, https://fiber.wiki // 🦸 Not all heroes wear capes, thank you to some amazing people -// πŸ’– @valyala, @dgrr, @erikdubbelboer, @savsgio, @julienschmidt +// πŸ’– @valyala, @erikdubbelboer, @savsgio, @julienschmidt, @koddr package fiber @@ -29,7 +29,7 @@ func (r *Fiber) Shutdown() error { return r.httpServer.Shutdown() } -// Listen : https://gofiber.github.io/fiber/#/application?id=listen +// Listen : https://fiber.wiki/application#listen func (r *Fiber) Listen(address interface{}, tls ...string) { host := "" switch val := address.(type) { diff --git a/methods.go b/methods.go index 1eea8eb43a..349fed7825 100644 --- a/methods.go +++ b/methods.go @@ -1,9 +1,9 @@ -// πŸ”Œ Fiber is an Express.js inspired web framework build on πŸš€ Fasthttp. +// πŸš€ Fiber is an Express.js inspired web framework written in Go with πŸ’– // πŸ“Œ Please open an issue if you got suggestions or found a bug! -// πŸ–₯ https://github.com/gofiber/fiber +// πŸ–₯ Links: https://github.com/gofiber/fiber, https://fiber.wiki // 🦸 Not all heroes wear capes, thank you to some amazing people -// πŸ’– @valyala, @dgrr, @erikdubbelboer, @savsgio, @julienschmidt +// πŸ’– @valyala, @erikdubbelboer, @savsgio, @julienschmidt, @koddr package fiber diff --git a/request.go b/request.go index 23a0aa9f07..b02dc0805e 100644 --- a/request.go +++ b/request.go @@ -1,9 +1,9 @@ -// πŸ”Œ Fiber is an Express.js inspired web framework build on πŸš€ Fasthttp. +// πŸš€ Fiber is an Express.js inspired web framework written in Go with πŸ’– // πŸ“Œ Please open an issue if you got suggestions or found a bug! -// πŸ–₯ https://github.com/gofiber/fiber +// πŸ–₯ Links: https://github.com/gofiber/fiber, https://fiber.wiki // 🦸 Not all heroes wear capes, thank you to some amazing people -// πŸ’– @valyala, @dgrr, @erikdubbelboer, @savsgio, @julienschmidt +// πŸ’– @valyala, @erikdubbelboer, @savsgio, @julienschmidt, @koddr package fiber @@ -19,7 +19,7 @@ import ( "github.com/valyala/fasthttp" ) -// Accepts : https://gofiber.github.io/fiber/#/context?id=accepts +// Accepts : https://fiber.wiki/context#accepts func (ctx *Ctx) Accepts(offers ...string) string { if len(offers) == 0 { return "" @@ -57,7 +57,7 @@ func (ctx *Ctx) Accepts(offers ...string) string { return "" } -// AcceptsCharsets : https://gofiber.github.io/fiber/#/context?id=acceptscharsets +// AcceptsCharsets : https://fiber.wiki/context#acceptscharsets func (ctx *Ctx) AcceptsCharsets(offers ...string) string { if len(offers) == 0 { return "" @@ -83,7 +83,7 @@ func (ctx *Ctx) AcceptsCharsets(offers ...string) string { return "" } -// AcceptsEncodings : https://gofiber.github.io/fiber/#/context?id=acceptsencodings +// AcceptsEncodings : https://fiber.wiki/context#acceptsencodings func (ctx *Ctx) AcceptsEncodings(offers ...string) string { if len(offers) == 0 { return "" @@ -109,7 +109,7 @@ func (ctx *Ctx) AcceptsEncodings(offers ...string) string { return "" } -// AcceptsLanguages : https://gofiber.github.io/fiber/#/context?id=acceptslanguages +// AcceptsLanguages : https://fiber.wiki/context#acceptslanguages func (ctx *Ctx) AcceptsLanguages(offers ...string) string { if len(offers) == 0 { return "" @@ -134,18 +134,18 @@ func (ctx *Ctx) AcceptsLanguages(offers ...string) string { return "" } -// BaseUrl : https://gofiber.github.io/fiber/#/context?id=baseurl +// BaseUrl : https://fiber.wiki/context#baseurl func (ctx *Ctx) BaseUrl() string { fmt.Println("Fiber deprecated c.BaseUrl(), this will be removed in v2: Use c.BaseURL() instead") return ctx.BaseURL() } -// BaseURL : https://gofiber.github.io/fiber/#/context?id=baseurl +// BaseURL : https://fiber.wiki/context#baseurl func (ctx *Ctx) BaseURL() string { return ctx.Protocol() + "://" + ctx.Hostname() } -// BasicAuth : https://gofiber.github.io/fiber/#/context?id=basicauth +// BasicAuth : https://fiber.wiki/context#basicauth func (ctx *Ctx) BasicAuth() (user, pass string, ok bool) { auth := ctx.Get(fasthttp.HeaderAuthorization) if auth == "" { @@ -173,7 +173,7 @@ func (ctx *Ctx) BasicAuth() (user, pass string, ok bool) { return cs[:s], cs[s+1:], true } -// Body : https://gofiber.github.io/fiber/#/context?id=body +// Body : https://fiber.wiki/context#body func (ctx *Ctx) Body(args ...interface{}) string { if len(args) == 0 { return getString(ctx.Fasthttp.Request.Body()) @@ -196,7 +196,7 @@ func (ctx *Ctx) Body(args ...interface{}) string { return "" } -// BodyParser : https://gofiber.github.io/fiber/#/context?id=bodyparser +// BodyParser : https://fiber.wiki/context#bodyparser func (ctx *Ctx) BodyParser(v interface{}) error { cType := getString(ctx.Fasthttp.Request.Header.ContentType()) if cType == contentTypeJSON { @@ -204,10 +204,10 @@ func (ctx *Ctx) BodyParser(v interface{}) error { } else if cType == contentTypeXML { return xml.Unmarshal(ctx.Fasthttp.Request.Body(), v) } - return fmt.Errorf("Cannot Parse Content-Type: %v", cType) + return fmt.Errorf("Cannot parse Content-Type: %v", cType) } -// Cookies : https://gofiber.github.io/fiber/#/context?id=cookies +// Cookies : https://fiber.wiki/context#cookies func (ctx *Ctx) Cookies(args ...interface{}) string { if len(args) == 0 { return ctx.Get(fasthttp.HeaderCookie) @@ -229,22 +229,22 @@ func (ctx *Ctx) Cookies(args ...interface{}) string { return "" } -// FormFile : https://gofiber.github.io/fiber/#/context?id=formfile +// FormFile : https://fiber.wiki/context#formfile func (ctx *Ctx) FormFile(key string) (*multipart.FileHeader, error) { return ctx.Fasthttp.FormFile(key) } -// FormValue : https://gofiber.github.io/fiber/#/context?id=formvalue +// FormValue : https://fiber.wiki/context#formvalue func (ctx *Ctx) FormValue(key string) string { return getString(ctx.Fasthttp.FormValue(key)) } -// Fresh : https://gofiber.github.io/fiber/#/context?id=fresh +// Fresh : https://fiber.wiki/context#fresh func (ctx *Ctx) Fresh() bool { return true } -// Get : https://gofiber.github.io/fiber/#/context?id=get +// Get : https://fiber.wiki/context#get func (ctx *Ctx) Get(key string) string { if key == "referrer" { key = "referer" @@ -252,7 +252,7 @@ func (ctx *Ctx) Get(key string) string { return getString(ctx.Fasthttp.Request.Header.Peek(key)) } -// Hostname : https://gofiber.github.io/fiber/#/context?id=hostname +// Hostname : https://fiber.wiki/context#hostname func (ctx *Ctx) Hostname() string { return getString(ctx.Fasthttp.URI().Host()) } @@ -263,7 +263,7 @@ func (ctx *Ctx) Ip() string { return ctx.IP() } -// IP : https://gofiber.github.io/fiber/#/context?id=Ip +// IP : https://fiber.wiki/context#Ip func (ctx *Ctx) IP() string { return ctx.Fasthttp.RemoteIP().String() } @@ -274,7 +274,7 @@ func (ctx *Ctx) Ips() []string { // NOLINT return ctx.IPs() } -// IPs : https://gofiber.github.io/fiber/#/context?id=ips +// IPs : https://fiber.wiki/context#ips func (ctx *Ctx) IPs() []string { ips := strings.Split(ctx.Get(fasthttp.HeaderXForwardedFor), ",") for i := range ips { @@ -283,7 +283,7 @@ func (ctx *Ctx) IPs() []string { return ips } -// Is : https://gofiber.github.io/fiber/#/context?id=is +// Is : https://fiber.wiki/context#is func (ctx *Ctx) Is(ext string) bool { if ext[0] != '.' { ext = "." + ext @@ -300,7 +300,7 @@ func (ctx *Ctx) Is(ext string) bool { return false } -// Locals : https://gofiber.github.io/fiber/#/context?id=locals +// Locals : https://fiber.wiki/context#locals func (ctx *Ctx) Locals(key string, val ...interface{}) interface{} { if len(val) == 0 { return ctx.Fasthttp.UserValue(key) @@ -310,12 +310,12 @@ func (ctx *Ctx) Locals(key string, val ...interface{}) interface{} { return nil } -// Method : https://gofiber.github.io/fiber/#/context?id=method +// Method : https://fiber.wiki/context#method func (ctx *Ctx) Method() string { return getString(ctx.Fasthttp.Request.Header.Method()) } -// MultipartForm : https://gofiber.github.io/fiber/#/context?id=multipartform +// MultipartForm : https://fiber.wiki/context#multipartform func (ctx *Ctx) MultipartForm() (*multipart.Form, error) { return ctx.Fasthttp.MultipartForm() } @@ -326,12 +326,12 @@ func (ctx *Ctx) OriginalUrl() string { return ctx.OriginalURL() } -// OriginalURL : https://gofiber.github.io/fiber/#/context?id=originalurl +// OriginalURL : https://fiber.wiki/context#originalurl func (ctx *Ctx) OriginalURL() string { return getString(ctx.Fasthttp.Request.Header.RequestURI()) } -// Params : https://gofiber.github.io/fiber/#/context?id=params +// Params : https://fiber.wiki/context#params func (ctx *Ctx) Params(key string) string { for i := 0; i < len(*ctx.params); i++ { if (*ctx.params)[i] == key { @@ -341,12 +341,12 @@ func (ctx *Ctx) Params(key string) string { return "" } -// Path : https://gofiber.github.io/fiber/#/context?id=path +// Path : https://fiber.wiki/context#path func (ctx *Ctx) Path() string { return getString(ctx.Fasthttp.URI().Path()) } -// Protocol : https://gofiber.github.io/fiber/#/context?id=protocol +// Protocol : https://fiber.wiki/context#protocol func (ctx *Ctx) Protocol() string { if ctx.Fasthttp.IsTLS() { return "https" @@ -354,45 +354,49 @@ func (ctx *Ctx) Protocol() string { return "http" } -// Query : https://gofiber.github.io/fiber/#/context?id=query +// Query : https://fiber.wiki/context#query func (ctx *Ctx) Query(key string) string { return getString(ctx.Fasthttp.QueryArgs().Peek(key)) } -// Range : https://gofiber.github.io/fiber/#/context?id=range +// Range : https://fiber.wiki/context#range func (ctx *Ctx) Range() { } -// Route : https://gofiber.github.io/fiber/#/context?id=route +// Route : https://fiber.wiki/context#route func (ctx *Ctx) Route() *Route { return ctx.route } -// SaveFile : https://gofiber.github.io/fiber/#/context?id=secure +// SaveFile : https://fiber.wiki/context#secure func (ctx *Ctx) SaveFile(fh *multipart.FileHeader, path string) error { return fasthttp.SaveMultipartFile(fh, path) } -// Secure : https://gofiber.github.io/fiber/#/context?id=secure +// Secure : https://fiber.wiki/context#secure func (ctx *Ctx) Secure() bool { return ctx.Fasthttp.IsTLS() } -// SignedCookies : https://gofiber.github.io/fiber/#/context?id=signedcookies +// SignedCookies : https://fiber.wiki/context#signedcookies func (ctx *Ctx) SignedCookies() { } -// Stale : https://gofiber.github.io/fiber/#/context?id=stale +// Stale : https://fiber.wiki/context#stale func (ctx *Ctx) Stale() bool { return true } -// Subdomains : https://gofiber.github.io/fiber/#/context?id=subdomains -func (ctx *Ctx) Subdomains() (subs []string) { +// Subdomains : https://fiber.wiki/context#subdomains +func (ctx *Ctx) Subdomains(offset ...int) (subs []string) { + o := 2 + if len(offset) > 0 { + o = offset[0] + } subs = strings.Split(ctx.Hostname(), ".") - subs = subs[:len(subs)-2] + subs = subs[:len(subs)-o] return subs } @@ -402,7 +406,7 @@ func (ctx *Ctx) Xhr() bool { return ctx.XHR() } -// XHR : https://gofiber.github.io/fiber/#/context?id=xhr +// XHR : https://fiber.wiki/context#xhr func (ctx *Ctx) XHR() bool { return ctx.Get(fasthttp.HeaderXRequestedWith) == "XMLHttpRequest" } diff --git a/response.go b/response.go index 4a71839fad..0fbf5c7271 100644 --- a/response.go +++ b/response.go @@ -1,9 +1,9 @@ -// πŸ”Œ Fiber is an Express.js inspired web framework build on πŸš€ Fasthttp. +// πŸš€ Fiber is an Express.js inspired web framework written in Go with πŸ’– // πŸ“Œ Please open an issue if you got suggestions or found a bug! -// πŸ–₯ https://github.com/gofiber/fiber +// πŸ–₯ Links: https://github.com/gofiber/fiber, https://fiber.wiki // 🦸 Not all heroes wear capes, thank you to some amazing people -// πŸ’– @valyala, @dgrr, @erikdubbelboer, @savsgio, @julienschmidt +// πŸ’– @valyala, @erikdubbelboer, @savsgio, @julienschmidt, @koddr package fiber @@ -19,7 +19,7 @@ import ( "github.com/valyala/fasthttp" ) -// Append : https://gofiber.github.io/fiber/#/context?id=append +// Append : https://fiber.wiki/context#append func (ctx *Ctx) Append(field string, values ...string) { if len(values) == 0 { return @@ -35,7 +35,7 @@ func (ctx *Ctx) Append(field string, values ...string) { ctx.Set(field, h) } -// Attachment : https://gofiber.github.io/fiber/#/context?id=attachment +// Attachment : https://fiber.wiki/context#attachment func (ctx *Ctx) Attachment(name ...string) { if len(name) > 0 { filename := filepath.Base(name[0]) @@ -46,7 +46,7 @@ func (ctx *Ctx) Attachment(name ...string) { ctx.Set(fasthttp.HeaderContentDisposition, "attachment") } -// ClearCookie : https://gofiber.github.io/fiber/#/context?id=clearcookie +// ClearCookie : https://fiber.wiki/context#clearcookie func (ctx *Ctx) ClearCookie(name ...string) { if len(name) > 0 { for i := range name { @@ -61,7 +61,7 @@ func (ctx *Ctx) ClearCookie(name ...string) { }) } -// Cookie : https://gofiber.github.io/fiber/#/context?id=cookie +// Cookie : https://fiber.wiki/context#cookie func (ctx *Ctx) Cookie(key, value string, options ...interface{}) { cook := &fasthttp.Cookie{} @@ -111,7 +111,7 @@ func (ctx *Ctx) Cookie(key, value string, options ...interface{}) { ctx.Fasthttp.Response.Header.SetCookie(cook) } -// Download : https://gofiber.github.io/fiber/#/context?id=download +// Download : https://fiber.wiki/context#download func (ctx *Ctx) Download(file string, name ...string) { filename := filepath.Base(file) @@ -123,12 +123,12 @@ func (ctx *Ctx) Download(file string, name ...string) { ctx.SendFile(file) } -// End : https://gofiber.github.io/fiber/#/context?id=end +// End : https://fiber.wiki/context#end func (ctx *Ctx) End() { } -// Format : https://gofiber.github.io/fiber/#/context?id=format +// Format : https://fiber.wiki/context#format func (ctx *Ctx) Format(args ...interface{}) { var body string @@ -156,7 +156,7 @@ func (ctx *Ctx) Format(args ...interface{}) { } } -// HeadersSent : https://gofiber.github.io/fiber/#/context?id=headerssent +// HeadersSent : https://fiber.wiki/context#headerssent func (ctx *Ctx) HeadersSent() { } @@ -167,7 +167,7 @@ func (ctx *Ctx) Json(v interface{}) error { return ctx.JSON(v) } -// JSON : https://gofiber.github.io/fiber/#/context?id=json +// JSON : https://fiber.wiki/context#json func (ctx *Ctx) JSON(v interface{}) error { raw, err := jsoniter.Marshal(&v) if err != nil { @@ -186,7 +186,7 @@ func (ctx *Ctx) JsonBytes(raw []byte) { ctx.JSONBytes(raw) } -// JSONBytes : https://gofiber.github.io/fiber/#/context?id=jsonbytes +// JSONBytes : https://fiber.wiki/context#jsonbytes func (ctx *Ctx) JSONBytes(raw []byte) { ctx.Fasthttp.Response.Header.SetContentType(contentTypeJSON) ctx.Fasthttp.Response.SetBodyString(getString(raw)) @@ -198,7 +198,7 @@ func (ctx *Ctx) Jsonp(v interface{}, cb ...string) error { return ctx.JSONP(v, cb...) } -// JSONP : https://gofiber.github.io/fiber/#/context?id=jsonp +// JSONP : https://fiber.wiki/context#jsonp func (ctx *Ctx) JSONP(v interface{}, cb ...string) error { raw, err := jsoniter.Marshal(&v) if err != nil { @@ -224,13 +224,13 @@ func (ctx *Ctx) JsonString(raw string) { ctx.JSONString(raw) } -// JSONString : https://gofiber.github.io/fiber/#/context?id=jsonstring +// JSONString : https://fiber.wiki/context#jsonstring func (ctx *Ctx) JSONString(raw string) { ctx.Fasthttp.Response.Header.SetContentType(contentTypeJSON) ctx.Fasthttp.Response.SetBodyString(raw) } -// Links : https://gofiber.github.io/fiber/#/context?id=links +// Links : https://fiber.wiki/context#links func (ctx *Ctx) Links(link ...string) { h := "" for i, l := range link { @@ -247,12 +247,12 @@ func (ctx *Ctx) Links(link ...string) { } } -// Location : https://gofiber.github.io/fiber/#/context?id=location +// Location : https://fiber.wiki/context#location func (ctx *Ctx) Location(path string) { ctx.Set(fasthttp.HeaderLocation, path) } -// Next : https://gofiber.github.io/fiber/#/context?id=next +// Next : https://fiber.wiki/context#next func (ctx *Ctx) Next() { ctx.route = nil ctx.next = true @@ -260,7 +260,7 @@ func (ctx *Ctx) Next() { ctx.values = nil } -// Redirect : https://gofiber.github.io/fiber/#/context?id=redirect +// Redirect : https://fiber.wiki/context#redirect func (ctx *Ctx) Redirect(path string, status ...int) { code := 302 if len(status) > 0 { @@ -271,12 +271,12 @@ func (ctx *Ctx) Redirect(path string, status ...int) { ctx.Fasthttp.Response.SetStatusCode(code) } -// Render : https://gofiber.github.io/fiber/#/context?id=render +// Render : https://fiber.wiki/context#render func (ctx *Ctx) Render() { } -// Send : https://gofiber.github.io/fiber/#/context?id=send +// Send : https://fiber.wiki/context#send func (ctx *Ctx) Send(args ...interface{}) { if len(args) == 0 { return @@ -292,12 +292,12 @@ func (ctx *Ctx) Send(args ...interface{}) { } } -// SendBytes : https://gofiber.github.io/fiber/#/context?id=sendbytes +// SendBytes : https://fiber.wiki/context#sendbytes func (ctx *Ctx) SendBytes(body []byte) { ctx.Fasthttp.Response.SetBodyString(getString(body)) } -// SendFile : https://gofiber.github.io/fiber/#/context?id=sendfile +// SendFile : https://fiber.wiki/context#sendfile func (ctx *Ctx) SendFile(file string, gzip ...bool) { // Disable gzipping if len(gzip) > 0 && !gzip[0] { @@ -311,7 +311,7 @@ func (ctx *Ctx) SendFile(file string, gzip ...bool) { //ctx.Fasthttp.SendFile(path) } -// SendStatus : https://gofiber.github.io/fiber/#/context?id=sendstatus +// SendStatus : https://fiber.wiki/context#sendstatus func (ctx *Ctx) SendStatus(status int) { ctx.Fasthttp.Response.SetStatusCode(status) @@ -324,29 +324,29 @@ func (ctx *Ctx) SendStatus(status int) { } } -// SendString : https://gofiber.github.io/fiber/#/context?id=sendstring +// SendString : https://fiber.wiki/context#sendstring func (ctx *Ctx) SendString(body string) { ctx.Fasthttp.Response.SetBodyString(body) } -// Set : https://gofiber.github.io/fiber/#/context?id=set +// Set : https://fiber.wiki/context#set func (ctx *Ctx) Set(key string, val string) { ctx.Fasthttp.Response.Header.SetCanonical(getBytes(key), getBytes(val)) } -// Status : https://gofiber.github.io/fiber/#/context?id=status +// Status : https://fiber.wiki/context#status func (ctx *Ctx) Status(status int) *Ctx { ctx.Fasthttp.Response.SetStatusCode(status) return ctx } -// Type : https://gofiber.github.io/fiber/#/context?id=type +// Type : https://fiber.wiki/context#type func (ctx *Ctx) Type(ext string) *Ctx { ctx.Fasthttp.Response.Header.SetContentType(getType(ext)) return ctx } -// Vary : https://gofiber.github.io/fiber/#/context?id=vary +// Vary : https://fiber.wiki/context#vary func (ctx *Ctx) Vary(fields ...string) { if len(fields) == 0 { return @@ -364,7 +364,7 @@ func (ctx *Ctx) Vary(fields ...string) { ctx.Set(fasthttp.HeaderVary, h) } -// Write : https://gofiber.github.io/fiber/#/context?id=write +// Write : https://fiber.wiki/context#write func (ctx *Ctx) Write(args ...interface{}) { for i := range args { switch body := args[i].(type) { @@ -384,7 +384,7 @@ func (ctx *Ctx) Xml(v interface{}) error { return ctx.XML(v) } -// XML : https://gofiber.github.io/fiber/#/context?id=xml +// XML : https://fiber.wiki/context#xml func (ctx *Ctx) XML(v interface{}) error { raw, err := xml.Marshal(v) if err != nil { diff --git a/router.go b/router.go index 8bc6bcc75a..27fa85b0ec 100644 --- a/router.go +++ b/router.go @@ -1,9 +1,9 @@ -// πŸ”Œ Fiber is an Express.js inspired web framework build on πŸš€ Fasthttp. +// πŸš€ Fiber is an Express.js inspired web framework written in Go with πŸ’– // πŸ“Œ Please open an issue if you got suggestions or found a bug! -// πŸ–₯ https://github.com/gofiber/fiber +// πŸ–₯ Links: https://github.com/gofiber/fiber, https://fiber.wiki // 🦸 Not all heroes wear capes, thank you to some amazing people -// πŸ’– @valyala, @dgrr, @erikdubbelboer, @savsgio, @julienschmidt +// πŸ’– @valyala, @erikdubbelboer, @savsgio, @julienschmidt, @koddr package fiber diff --git a/static.go b/static.go index 4de397307a..9779065fd4 100644 --- a/static.go +++ b/static.go @@ -1,9 +1,9 @@ -// πŸ”Œ Fiber is an Express.js inspired web framework build on πŸš€ Fasthttp. +// πŸš€ Fiber is an Express.js inspired web framework written in Go with πŸ’– // πŸ“Œ Please open an issue if you got suggestions or found a bug! -// πŸ–₯ https://github.com/gofiber/fiber +// πŸ–₯ Links: https://github.com/gofiber/fiber, https://fiber.wiki // 🦸 Not all heroes wear capes, thank you to some amazing people -// πŸ’– @valyala, @dgrr, @erikdubbelboer, @savsgio, @julienschmidt +// πŸ’– @valyala, @erikdubbelboer, @savsgio, @julienschmidt, @koddr package fiber @@ -14,7 +14,7 @@ import ( "strings" ) -// Static https://gofiber.github.io/fiber/#/application?id=static +// Static https://fiber.wiki/application#static func (r *Fiber) Static(args ...string) { prefix := "/" root := "./" diff --git a/status.go b/status.go index eeead617d9..2755d3234e 100644 --- a/status.go +++ b/status.go @@ -1,13 +1,12 @@ -// πŸ”Œ Fiber is an Express.js inspired web framework build on πŸš€ Fasthttp. +// πŸš€ Fiber is an Express.js inspired web framework written in Go with πŸ’– // πŸ“Œ Please open an issue if you got suggestions or found a bug! -// πŸ–₯ https://github.com/gofiber/fiber +// πŸ–₯ Links: https://github.com/gofiber/fiber, https://fiber.wiki // 🦸 Not all heroes wear capes, thank you to some amazing people -// πŸ’– @valyala, @dgrr, @erikdubbelboer, @savsgio, @julienschmidt +// πŸ’– @valyala, @erikdubbelboer, @savsgio, @julienschmidt, @koddr package fiber -// statusMessages https://gofiber.github.io/fiber/#/context?id=sendstatus var statusMessages = map[int]string{ 100: "Continue", 101: "Switching Protocols", diff --git a/types.go b/types.go index 7b6bc1f110..ac38053fd2 100644 --- a/types.go +++ b/types.go @@ -1,13 +1,12 @@ -// πŸ”Œ Fiber is an Express.js inspired web framework build on πŸš€ Fasthttp. +// πŸš€ Fiber is an Express.js inspired web framework written in Go with πŸ’– // πŸ“Œ Please open an issue if you got suggestions or found a bug! -// πŸ–₯ https://github.com/gofiber/fiber +// πŸ–₯ Links: https://github.com/gofiber/fiber, https://fiber.wiki // 🦸 Not all heroes wear capes, thank you to some amazing people -// πŸ’– @valyala, @dgrr, @erikdubbelboer, @savsgio, @julienschmidt +// πŸ’– @valyala, @erikdubbelboer, @savsgio, @julienschmidt, @koddr package fiber -// common content types const ( contentTypeJSON = "application/json" contentTypeJs = "application/javascript" diff --git a/utils.go b/utils.go index ce4b9a2ee8..806a6e12f6 100644 --- a/utils.go +++ b/utils.go @@ -1,9 +1,9 @@ -// πŸ”Œ Fiber is an Express.js inspired web framework build on πŸš€ Fasthttp. +// πŸš€ Fiber is an Express.js inspired web framework written in Go with πŸ’– // πŸ“Œ Please open an issue if you got suggestions or found a bug! -// πŸ–₯ https://github.com/gofiber/fiber +// πŸ–₯ Links: https://github.com/gofiber/fiber, https://fiber.wiki // 🦸 Not all heroes wear capes, thank you to some amazing people -// πŸ’– @valyala, @dgrr, @erikdubbelboer, @savsgio, @julienschmidt +// πŸ’– @valyala, @erikdubbelboer, @savsgio, @julienschmidt, @koddr package fiber