From c78d94e6ffe7c8b5ec94aeac3ffda421401f91c8 Mon Sep 17 00:00:00 2001 From: Fenny <25108519+Fenny@users.noreply.github.com> Date: Wed, 4 Mar 2020 14:51:02 +0100 Subject: [PATCH 01/26] Delete logger.go.fasthttp.gz --- middleware/logger.go.fasthttp.gz | Bin 1333 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 middleware/logger.go.fasthttp.gz diff --git a/middleware/logger.go.fasthttp.gz b/middleware/logger.go.fasthttp.gz deleted file mode 100644 index 8767ca83f8430c7346abcce55ad163b1663ce8e0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1333 zcmV-51A`DJdr_!~K)VN6#DRHiG(|&NG zYL6SZm4T(ZgU_cE|GgS^xwp7E*OCvIo#)wk+nH@eek)3ZTF&PcE``Rx4}4j-N)tqZ z?}f7!p$Yk|sA+ggH9VA+8q%^U-TSJ^hZmAHhRo!JrKCkSOLJ9cr7GkMbvFEl2a9*2 zT8T}S20pD?+!q_tT~4qLd@sx3`c}3u$3iw} zKtRzoIZ4$3DKNaWbvdg3dP(;&%#`BAEQ8ld z*Mc^C(E_1TWht8y3cIwFv~cTlxD#56S%v05w+&C$9Kjw=;bbja`>c@`YTm=ix)rqO zKhw#&6aD9g1DRzoRmR9!g>WaT4$TCZApzMY(CI3Hg))?YB}srO5@@v|m5**{EKs9P zpc4r!P|Q(Je!j)kiv<4ZP_M=h_KE+;?_8-{iS{e-Jr@mI7nb=CS)&s#h*~qrvR127 zi@KIgnU0A(=;=QQb3eyGE&f*6`_w0Of_QT}tJn+4p zU3ZQ7&{5kFNG^({mPDvwxj;Q6&4AG8#EsS8P%D#O(;T%9d~YOC>0eqB>cH7~OsXxdE?KJT3gnp3VVo$nuH8}zM*T^c_1l|h&Uj-$5(V9RwMlnn_zFOW* z43a~S?V;pT;sjB?IjpcM=>949MwP;T*G&Aj`P6x zWC0a6Zr>PQz}e6XJf^vDkejnFf$#NSG0k11?dh>(c~PdWfG#c|3^!~W>7I2iS#Hto z;%Ihi@qlV~0ClH>j!vw-Uj04|ml^PIF%&N)LsZ!No&lN5wHr+AEhENwG$8~Rw^)yna8yE%* z)4%MB0(Df2Ta0eLusDJ5&!5MCwY|w_<&A0SYH6&zX4uimaeQ1l=E7j=k@aYvw zySE*?A7{3Mq}LT<8$E-k7Ii(?Y!x^hULVB|=5w5Pfj-bW;U&i>?y%D9{JN3y#Mw From db6a8674324bd73a3035205dc534a3841a81674f Mon Sep 17 00:00:00 2001 From: Fenny <25108519+Fenny@users.noreply.github.com> Date: Wed, 4 Mar 2020 20:02:12 +0100 Subject: [PATCH 02/26] Add hall of fame --- .github/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/README.md b/.github/README.md index 8490282c..27a2ca7d 100644 --- a/.github/README.md +++ b/.github/README.md @@ -492,3 +492,5 @@ If you want to say **thank you** and/or support the active development of `Fiber ## ⚠️ License `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). + +[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/0)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/0)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/1)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/1)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/2)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/2)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/3)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/3)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/4)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/4)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/5)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/5)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/6)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/6)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/7)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/7) From 1ec16e192df436bf9767f7efa04beec3c93a0865 Mon Sep 17 00:00:00 2001 From: Fenny <25108519+Fenny@users.noreply.github.com> Date: Thu, 5 Mar 2020 09:04:50 +0100 Subject: [PATCH 03/26] Update hall of fame --- .github/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 27a2ca7d..4d45f0dc 100644 --- a/.github/README.md +++ b/.github/README.md @@ -493,4 +493,10 @@ If you want to say **thank you** and/or support the active development of `Fiber `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). -[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/0)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/0)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/1)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/1)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/2)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/2)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/3)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/3)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/4)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/4)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/5)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/5)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/6)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/6)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/7)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/7) +[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/0)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/0) +[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/1)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/1) +[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/2)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/2) +[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/3)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/3) +[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/4)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/4) +[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/5)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/5) +[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/6)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/6) From f2e332f1e74f29e3890c7f663bd8a6a616d09201 Mon Sep 17 00:00:00 2001 From: Eka Putra Date: Thu, 5 Mar 2020 21:19:24 +1100 Subject: [PATCH 04/26] Added README_id.md --- .github/README_id.md | 496 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 496 insertions(+) create mode 100644 .github/README_id.md diff --git a/.github/README_id.md b/.github/README_id.md new file mode 100644 index 00000000..27a2ca7d --- /dev/null +++ b/.github/README_id.md @@ -0,0 +1,496 @@ +

+ + Fiber + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + +

+

+ Fiber is an Express inspired web framework build on top of Fasthttp, the fastest HTTP engine for Go. Designed to ease things up for fast development with zero memory allocation and performance in mind. +

+ +## ⚡️ Quickstart + +```go +package main + +import "github.com/gofiber/fiber" + +func main() { + app := fiber.New() + + app.Get("/", func(c *fiber.Ctx) { + c.Send("Hello, World!") + }) + + app.Listen(3000) +} +``` + +## ⚙️ Installation + +First of all, [download](https://golang.org/dl/) and install Go. `1.11` or higher is required. + +Installation is done using the [`go get`](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) command: + +```bash +go get -u 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). + +

+ + +

+ +## 🎯 Features + +- Robust [routing](https://fiber.wiki/routing) +- Serve [static files](https://fiber.wiki/application#static) +- Extreme [performance](https://fiber.wiki/benchmarks) +- [Low memory](https://fiber.wiki/benchmarks) footprint +- [API endpoints](https://fiber.wiki/context) +- Middleware & [Next](https://fiber.wiki/context#next) support +- [Rapid](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) server-side programming +- Available in 9 other languages +- And much more, [explore Fiber](https://fiber.wiki/) + +## 💡 Philosophy + +New gophers that make the switch from [Node.js](https://nodejs.org/en/about/) to [Go](https://golang.org/doc/) are dealing with a learning curve before they can 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 with a warm and trusted welcome. + +Fiber is **inspired** by Express, the most popular web framework on the 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 or similar_), then many methods and principles will seem **very common** to you. + +We **listen** to our users in [issues](https://github.com/gofiber/fiber/issues) (_and all over the Internet_) to create a **fast**, **flexible** and **friendly** Go web framework for **any** tasks, **deadlines** and developer **skills**! Just like Express does in the JavaScript world. + +## 👀 Examples + +Listed below are some of the common examples. If you want to see more code examples, please visit our [Recipes repository](https://github.com/gofiber/recipes) or visit our [API documentation](https://fiber.wiki). + +### Routing + +```go +func main() { + app := fiber.New() + + // GET /john + app.Get("/:name", func(c *fiber.Ctx) { + fmt.Printf("Hello %s!", c.Params("name")) + // => Hello john! + }) + + // GET /john + app.Get("/:name/:age?", func(c *fiber.Ctx) { + fmt.Printf("Name: %s, Age: %s", c.Params("name"), c.Params("age")) + // => Name: john, Age: + }) + + // GET /api/register + app.Get("/api*", func(c *fiber.Ctx) { + fmt.Printf("/api%s", c.Params("*")) + // => /api/register + }) + + app.Listen(3000) +} +``` + +### Serve static files +https://fiber.wiki/application#static +```go +func main() { + app := fiber.New() + + app.Static("/", "/public") + // => http://localhost:3000/js/script.js + // => http://localhost:3000/css/style.css + + app.Static("/prefix", "/public") + // => http://localhost:3000/prefix/js/script.js + // => http://localhost:3000/prefix/css/style.css + + app.Static("*", "/public/index.html") + // => http://localhost:3000/any/path/shows/index/html + + app.Listen(3000) +} +``` + +### Middleware & Next +https://fiber.wiki/routing#middleware +https://fiber.wiki/context#next +```go +func main() { + app := fiber.New() + + // Match any route + app.Use(func(c *fiber.Ctx) { + fmt.Println("First middleware") + c.Next() + }) + + // Match all routes starting with /api + app.Use("/api", func(c *fiber.Ctx) { + fmt.Println("Second middleware") + c.Next() + }) + + // POST /api/register + app.Post("/api/register", func(c *fiber.Ctx) { + fmt.Println("Last middleware") + c.Send("Hello, World!") + }) + + app.Listen(3000) +} +``` + +
+ 📚 Show more code examples + +### Template engines +https://fiber.wiki/application#settings +https://fiber.wiki/context#render + +Supported engines: +- [html](https://golang.org/pkg/html/template/) +- [amber](https://github.com/eknkc/amber) +- [handlebars](https://github.com/aymerick/raymond) +- [mustache](https://github.com/cbroglie/mustache) +- [pug](https://github.com/Joker/jade) + +```go +func main() { + // You can setup template engine before initiation app: + app := fiber.New(&fiber.Settings{ + TemplateEngine: "mustache", + TemplateFolder: "./views", + TemplateExtension: ".tmpl", + }) + + // OR after initiation app at any convenient location: + app.Settings.TemplateEngine = "mustache" + app.Settings.TemplateFolder = "./views" + app.Settings.TemplateExtension = ".tmpl" + + // And now, you can call template `./views/home.tmpl` like this: + app.Get("/", func(c *fiber.Ctx) { + c.Render("home", fiber.Map{ + "title": "Homepage", + "year": 1999, + }) + }) + + // ... +} +``` + +### Grouping routes into chains +https://fiber.wiki/application#group +```go +func main() { + app := fiber.New() + + // Root API route + api := app.Group("/api", cors()) // /api + + // API v1 routes + v1 := api.Group("/v1", mysql()) // /api/v1 + v1.Get("/list", handler) // /api/v1/list + v1.Get("/user", handler) // /api/v1/user + + // API v2 routes + v2 := api.Group("/v2", mongodb()) // /api/v2 + v2.Get("/list", handler) // /api/v2/list + v2.Get("/user", handler) // /api/v2/user + + // ... +} +``` + +### Middleware logger +https://fiber.wiki/middleware#logger +```go +import ( + "github.com/gofiber/fiber" + "github.com/gofiber/fiber/middleware" +) + +func main() { + app := fiber.New() + + // If you want to change default Logger config + loggerConfig := middleware.LoggerConfig{ + Format: "${time} - ${method} ${path}\n", + TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST", + } + + // Middleware for Logger with config + app.Use(middleware.Logger(loggerConfig)) + + // ... +} +``` + +### Cross-Origin Resource Sharing (CORS) +https://fiber.wiki/middleware#cors + +[CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. A web application executes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, or port) from its own. + +```go +import ( + "github.com/gofiber/fiber" + "github.com/gofiber/fiber/middleware" +) + +func main() { + app := fiber.New() + + // Connect CORS for each route as middleware + app.Use(middleware.CORS()) + + app.Get("/", func(c *fiber.Ctx) { + c.Send("CORS is enabled!") + }) + + app.Listen(3000) +} +``` + +Check CORS by passing any domain in `Origin` header: + +```bash +curl -H "Origin: http://example.com" --verbose http://localhost:3000 +``` + +### Custom 404 response + +```go +func main() { + app := fiber.New() + + app.Static("/public") + + app.Get("/demo", func(c *fiber.Ctx) { + c.Send("This is a demo!") + }) + + app.Post("/register", func(c *fiber.Ctx) { + c.Send("Welcome!") + }) + + // Last middleware to match anything + app.Use(func(c *fiber.Ctx) { + c.SendStatus(404) // => 404 "Not Found" + }) + + app.Listen(3000) +} +``` + +### JSON Response +https://fiber.wiki/context#json +```go +type User struct { + Name string `json:"name"` + Age int `json:"age"` +} + +func main() { + app := fiber.New() + + app.Get("/user", func(c *fiber.Ctx) { + c.JSON(&User{"John", 20}) + // {"name":"John", "age":20} + }) + + app.Get("/json", func(c *fiber.Ctx) { + c.JSON(&fiber.Map{ + "success": true, + "message": "Hi John!", + }) + // {"success":true, "message":"Hi John!"} + }) + + app.Listen(3000) +} +``` + +### WebSocket support +https://fiber.wiki/application#websocket +```go +func main() { + app := fiber.New() + + app.WebSocket("/ws", func(c *fiber.Conn) { + for { + mt, msg, err := c.ReadMessage() + if err != nil { + log.Println("read:", err) + break + } + + log.Printf("recovery: %s", msg) + + err = c.WriteMessage(mt, msg) + if err != nil { + log.Println("write:", err) + break + } + } + }) + + // Listen on ws://localhost:3000/ws + app.Listen(3000) +} +``` + +### Recover middleware +https://fiber.wiki/middleware#recover +```go +package main + +import ( + "github.com/gofiber/fiber" + "github.com/gofiber/fiber/middleware" +) + +func main() { + app := fiber.New() + + app.Use(middleware.Recover(func(c *fiber.Ctx, err error) { + log.Println(err) // "Something went wrong!" + c.SendStatus(500) // Internal Server Error + }))) + + app.Get("/", func(c *fiber.Ctx) { + panic("Something went wrong!") + }) + + app.Listen(3000) +} +``` +
+ +## 💬 Media + +- [Welcome to Fiber — an Express.js styled web framework written in Go with ❤️](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) (_by [Vic Shóstak](https://github.com/koddr), 03 Feb 2020_) +- [Fiber release v1.7 is out now! 🎉 What's new and is he still fast, flexible and friendly?](https://dev.to/koddr/fiber-v2-is-out-now-what-s-new-and-is-he-still-fast-flexible-and-friendly-3ipf) (_by [Vic Shóstak](https://github.com/koddr), 21 Feb 2020_) + +## 👍 Contribute + +If you want to say **thank you** and/or support the active development of `Fiber`: + +1. Add a [GitHub Star](https://github.com/gofiber/fiber/stargazers) to the project. +2. Tweet about the project [on your Twitter](https://twitter.com/intent/tweet?text=%F0%9F%9A%80%20Fiber%20%E2%80%94%20is%20an%20Express.js%20inspired%20web%20framework%20build%20on%20Fasthttp%20for%20%23Go%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber). +3. Write a review or tutorial on [Medium](https://medium.com/), [Dev.to](https://dev.to/) or personal blog. +4. Help us to translate this `README` to another language. + + +## ☕ Supporters + + + Buy Me A Coffee + + + + + + + + + + +
+ +
+ JustDave +
+
+ +
+ HenrikBinggl +
+
+ +
+ Vic Shóstak +
+
+ +
+ MarvinJWendt +
+
+ +
+ ToishY +
+
+ +## ⭐️ Stars + +Stars over time + +## ⚠️ License + +`Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). + +[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/0)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/0)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/1)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/1)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/2)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/2)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/3)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/3)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/4)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/4)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/5)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/5)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/6)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/6)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/7)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/7) From b8566b5acf987a84bf5bdbdefd1bb73b1e7e6439 Mon Sep 17 00:00:00 2001 From: Eka Putra Date: Thu, 5 Mar 2020 23:11:24 +1100 Subject: [PATCH 05/26] Translated to Indonesian --- .github/README_id.md | 88 ++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/.github/README_id.md b/.github/README_id.md index 27a2ca7d..91cd4204 100644 --- a/.github/README_id.md +++ b/.github/README_id.md @@ -3,9 +3,9 @@ Fiber
- + @@ -60,10 +60,10 @@

- Fiber is an Express inspired web framework build on top of Fasthttp, the fastest HTTP engine for Go. Designed to ease things up for fast development with zero memory allocation and performance in mind. + Fiber adalah web framework yang terinspirasi dari Express yang berbasiskan Fasthttp, HTTP engine paling cepat untuk Go. Dirancang untuk mempermudah, mempercepat pengembangan aplikasi dengan alokasi memori nol-nya serta kinerja yang selalu diperhatikan.

-## ⚡️ Quickstart +## ⚡️ Cara Mulai ```go package main @@ -81,48 +81,48 @@ func main() { } ``` -## ⚙️ Installation +## ⚙️ Instalasi -First of all, [download](https://golang.org/dl/) and install Go. `1.11` or higher is required. +Pertama, [unduh](https://golang.org/dl/) dan instal Go di komputer anda. Versi `1.11` atau yang lebih tinggi diperlukan. -Installation is done using the [`go get`](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) command: +Instalasi dilakukkan dengan perintah [`go get`](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them): ```bash go get -u github.com/gofiber/fiber/... ``` -## 🤖 Benchmarks +## 🤖 Pengukuran Kinerja -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). +Pengukuran ini dilakukan oleh [TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks) dan [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Apabila anda ingin melihat hasil lengkapnya, silahkan kunjungi halaman [Wiki](https://fiber.wiki/benchmarks) kami.

-## 🎯 Features +## 🎯 Fitur -- Robust [routing](https://fiber.wiki/routing) -- Serve [static files](https://fiber.wiki/application#static) -- Extreme [performance](https://fiber.wiki/benchmarks) -- [Low memory](https://fiber.wiki/benchmarks) footprint -- [API endpoints](https://fiber.wiki/context) -- Middleware & [Next](https://fiber.wiki/context#next) support -- [Rapid](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) server-side programming -- Available in 9 other languages -- And much more, [explore Fiber](https://fiber.wiki/) +- Sistem [Routing](https://fiber.wiki/routing) yang mudah +- Bisa menyajikan [file statis](https://fiber.wiki/application#static) +- [Kinerja](https://fiber.wiki/benchmarks) ekstrim +- [Penggunaan memori](https://fiber.wiki/benchmarks) yang kecil +- Cocok untuk pembuatan [API](https://fiber.wiki/context) +- Mendukung Middleware & [Next](https://fiber.wiki/context#next) seperti Express +- Kembangkan aplikasi dengan [Cepat](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) +- Tersedia di 10 bahasa lainnya +- Dan masih banyak lagi, [kunjungi Fiber](https://fiber.wiki/) -## 💡 Philosophy +## 💡 Filosofi -New gophers that make the switch from [Node.js](https://nodejs.org/en/about/) to [Go](https://golang.org/doc/) are dealing with a learning curve before they can 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 with a warm and trusted welcome. +Bagi yang baru yang beralih dari [Node.js](https://nodejs.org/en/about/) ke [Go](https://golang.org/doc/) terkadang perlu waktu yang cukup lama sebelum mereka mampu membuat aplikasi berbasis web dengan Go. Fiber, sebagai **web framework** dirancang secara **minimalis** dan mengikuti filosofi dari **UNIX**, sehingga pengguna baru dengan cepat memasuki dunia Go dengan sambutan yang hangat dan dapat diandalkan. -Fiber is **inspired** by Express, the most popular web framework on the 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 or similar_), then many methods and principles will seem **very common** to you. +Fiber terinspirasi dari Express, salah satu web framework paling terkenal di Internet. Kami menggabungkan **kemudahan** dari Express dan **kinerja luar biasa** dari Go. Apabila anda pernah membuat aplikasi dengan Node.js (_dengan Express atau yang lainnya_), maka banyak metode dan prinsip yang akan terasa **sangat umum** bagi anda. -We **listen** to our users in [issues](https://github.com/gofiber/fiber/issues) (_and all over the Internet_) to create a **fast**, **flexible** and **friendly** Go web framework for **any** tasks, **deadlines** and developer **skills**! Just like Express does in the JavaScript world. +Kami **mendengarkan** para pengguna di [GitHub Issues](https://github.com/gofiber/fiber/issues) (_dan berbagai platform lainnya_) untuk menciptakan web framework yang **cepat**, **fleksibel** dan **bersahabat** untuk berbagai macam keperluan, **tenggat waktu** dan **keahlian** para pengguna! Sama halnya seperti yang dilakukkan Express di dunia JavaScript. -## 👀 Examples +## 👀 Contoh -Listed below are some of the common examples. If you want to see more code examples, please visit our [Recipes repository](https://github.com/gofiber/recipes) or visit our [API documentation](https://fiber.wiki). +Dibawah ini terdapat beberapa contoh penggunaan. Jika anda ingin contoh lainnya, silahkan kunjungi [Gudang resep](https://github.com/gofiber/recipes) atau kunjungi [Dokumentasi API](https://fiber.wiki) kami. ### Routing @@ -152,7 +152,7 @@ func main() { } ``` -### Serve static files +### Menyajikan file statis https://fiber.wiki/application#static ```go func main() { @@ -203,13 +203,13 @@ func main() { ```
- 📚 Show more code examples + 📚 Perlihatkan contoh lainnya ### Template engines https://fiber.wiki/application#settings https://fiber.wiki/context#render -Supported engines: +Mendukung: - [html](https://golang.org/pkg/html/template/) - [amber](https://github.com/eknkc/amber) - [handlebars](https://github.com/aymerick/raymond) @@ -242,7 +242,7 @@ func main() { } ``` -### Grouping routes into chains +### Pengelompokan routes https://fiber.wiki/application#group ```go func main() { @@ -292,7 +292,7 @@ func main() { ### Cross-Origin Resource Sharing (CORS) https://fiber.wiki/middleware#cors -[CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. A web application executes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, or port) from its own. +[CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) adalah mekanisme yang menggunakan HTTP headers tambahan untuk memberitahu browser bahwa aplikasi/data kita hanya bisa diakses dari sumber (origin) tertentu, atau bisa juga diakses dari sumber berbeda. Aplikasi web memproses cross-origin HTTP request ketika request-nya berasal dari sumber berbeda (domain, protokol dan port). ```go import ( @@ -314,13 +314,13 @@ func main() { } ``` -Check CORS by passing any domain in `Origin` header: +Setelah diaktifkan, bisa dicoba dengan cara memberi sumber/domain berbeda di header `Origin`: ```bash curl -H "Origin: http://example.com" --verbose http://localhost:3000 ``` -### Custom 404 response +### Respon 404 ```go func main() { @@ -345,7 +345,7 @@ func main() { } ``` -### JSON Response +### Respon JSON https://fiber.wiki/context#json ```go type User struct { @@ -373,7 +373,7 @@ func main() { } ``` -### WebSocket support +### Dukungan WebSocket https://fiber.wiki/application#websocket ```go func main() { @@ -434,17 +434,17 @@ func main() { - [Welcome to Fiber — an Express.js styled web framework written in Go with ❤️](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) (_by [Vic Shóstak](https://github.com/koddr), 03 Feb 2020_) - [Fiber release v1.7 is out now! 🎉 What's new and is he still fast, flexible and friendly?](https://dev.to/koddr/fiber-v2-is-out-now-what-s-new-and-is-he-still-fast-flexible-and-friendly-3ipf) (_by [Vic Shóstak](https://github.com/koddr), 21 Feb 2020_) -## 👍 Contribute +## 👍 Berkontribusi -If you want to say **thank you** and/or support the active development of `Fiber`: +Apabila anda ingin mengucapkan **terima kasih** dan/atau mendukung pengembangan `Fiber`: -1. Add a [GitHub Star](https://github.com/gofiber/fiber/stargazers) to the project. -2. Tweet about the project [on your Twitter](https://twitter.com/intent/tweet?text=%F0%9F%9A%80%20Fiber%20%E2%80%94%20is%20an%20Express.js%20inspired%20web%20framework%20build%20on%20Fasthttp%20for%20%23Go%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber). -3. Write a review or tutorial on [Medium](https://medium.com/), [Dev.to](https://dev.to/) or personal blog. -4. Help us to translate this `README` to another language. +1. Berikan bintang atau [GitHub Star](https://github.com/gofiber/fiber/stargazers) ke proyek ini. +2. Bagikan [di Twitter anda](https://twitter.com/intent/tweet?text=%F0%9F%9A%80%20Fiber%20%E2%80%94%20is%20an%20Express.js%20inspired%20web%20framework%20build%20on%20Fasthttp%20for%20%23Go%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber). +3. Buat ulasan atau tutorial di [Medium](https://medium.com/), [Dev.to](https://dev.to/) atau blog pribadi anda. +4. Bantu kami menerjemahkan `README` ini ke bahasa lainnya. -## ☕ Supporters +## ☕ Para Pendukung Buy Me A Coffee @@ -485,12 +485,12 @@ If you want to say **thank you** and/or support the active development of `Fiber -## ⭐️ Stars +## ⭐️ Bintang Stars over time -## ⚠️ License +## ⚠️ Lisensi -`Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). +`Fiber` adalah perangkat lunak gratis dengan sumber terbuka berlisensi [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). [![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/0)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/0)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/1)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/1)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/2)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/2)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/3)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/3)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/4)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/4)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/5)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/5)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/6)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/6)[![](https://sourcerer.io/fame/Fenny/gofiber/fiber/images/7)](https://sourcerer.io/fame/Fenny/gofiber/fiber/links/7) From 88abe2f61ffbf5e81ffd390ff80d32ced8f85a3d Mon Sep 17 00:00:00 2001 From: Eka Putra Date: Thu, 5 Mar 2020 23:20:30 +1100 Subject: [PATCH 06/26] Added links to Indonesian Readme. --- .github/README.md | 3 +++ .github/README_de.md | 3 +++ .github/README_es.md | 3 +++ .github/README_fr.md | 3 +++ .github/README_id.md | 3 +++ .github/README_ja.md | 3 +++ .github/README_ko.md | 3 +++ .github/README_pt.md | 3 +++ .github/README_ru.md | 3 +++ .github/README_tr.md | 3 +++ .github/README_zh-CN.md | 3 +++ 11 files changed, 33 insertions(+) diff --git a/.github/README.md b/.github/README.md index 27a2ca7d..8dff5e20 100644 --- a/.github/README.md +++ b/.github/README.md @@ -33,6 +33,9 @@ + + +

diff --git a/.github/README_de.md b/.github/README_de.md index 92f7e4a7..60713867 100644 --- a/.github/README_de.md +++ b/.github/README_de.md @@ -33,6 +33,9 @@ + + +

diff --git a/.github/README_es.md b/.github/README_es.md index 2cc74526..693d4c12 100644 --- a/.github/README_es.md +++ b/.github/README_es.md @@ -33,6 +33,9 @@ + + +

diff --git a/.github/README_fr.md b/.github/README_fr.md index 8b995222..508c728a 100644 --- a/.github/README_fr.md +++ b/.github/README_fr.md @@ -33,6 +33,9 @@ + + +

diff --git a/.github/README_id.md b/.github/README_id.md index 91cd4204..dc6ba0a3 100644 --- a/.github/README_id.md +++ b/.github/README_id.md @@ -33,6 +33,9 @@ +

diff --git a/.github/README_ja.md b/.github/README_ja.md index 2c3c6d0e..405c00d2 100644 --- a/.github/README_ja.md +++ b/.github/README_ja.md @@ -33,6 +33,9 @@ + + +

diff --git a/.github/README_ko.md b/.github/README_ko.md index 70d55f21..26437de6 100644 --- a/.github/README_ko.md +++ b/.github/README_ko.md @@ -33,6 +33,9 @@ + + +

diff --git a/.github/README_pt.md b/.github/README_pt.md index 9027c34d..11f362bf 100644 --- a/.github/README_pt.md +++ b/.github/README_pt.md @@ -33,6 +33,9 @@ + + +

diff --git a/.github/README_ru.md b/.github/README_ru.md index 5f8a8e05..70c62950 100644 --- a/.github/README_ru.md +++ b/.github/README_ru.md @@ -33,6 +33,9 @@ + + +

diff --git a/.github/README_tr.md b/.github/README_tr.md index 810269ab..a720acd9 100644 --- a/.github/README_tr.md +++ b/.github/README_tr.md @@ -30,6 +30,9 @@ + + +

diff --git a/.github/README_zh-CN.md b/.github/README_zh-CN.md index 6a20c308..06cb4562 100644 --- a/.github/README_zh-CN.md +++ b/.github/README_zh-CN.md @@ -30,6 +30,9 @@ + + +

From d47aecb5de0c3b7b981f5d2f75e4026123875f47 Mon Sep 17 00:00:00 2001 From: Eka Putra Date: Thu, 5 Mar 2020 23:41:13 +1100 Subject: [PATCH 07/26] More updates on indonesian readme. --- .github/README.md | 2 +- .github/README_id.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/README.md b/.github/README.md index 8dff5e20..bd1e8f54 100644 --- a/.github/README.md +++ b/.github/README.md @@ -112,7 +112,7 @@ These tests are performed by [TechEmpower](https://github.com/TechEmpower/Framew - [API endpoints](https://fiber.wiki/context) - Middleware & [Next](https://fiber.wiki/context#next) support - [Rapid](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) server-side programming -- Available in 9 other languages +- Available in 10 other languages - And much more, [explore Fiber](https://fiber.wiki/) ## 💡 Philosophy diff --git a/.github/README_id.md b/.github/README_id.md index dc6ba0a3..3e9a0bd2 100644 --- a/.github/README_id.md +++ b/.github/README_id.md @@ -105,11 +105,11 @@ Pengukuran ini dilakukan oleh [TechEmpower](https://github.com/TechEmpower/Frame ## 🎯 Fitur -- Sistem [Routing](https://fiber.wiki/routing) yang mudah -- Bisa menyajikan [file statis](https://fiber.wiki/application#static) +- Sistem [Routing](https://fiber.wiki/routing) yang solid +- Serve [file statis](https://fiber.wiki/application#static) - [Kinerja](https://fiber.wiki/benchmarks) ekstrim - [Penggunaan memori](https://fiber.wiki/benchmarks) yang kecil -- Cocok untuk pembuatan [API](https://fiber.wiki/context) +- Cocok untuk [API](https://fiber.wiki/context) - Mendukung Middleware & [Next](https://fiber.wiki/context#next) seperti Express - Kembangkan aplikasi dengan [Cepat](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) - Tersedia di 10 bahasa lainnya @@ -117,7 +117,7 @@ Pengukuran ini dilakukan oleh [TechEmpower](https://github.com/TechEmpower/Frame ## 💡 Filosofi -Bagi yang baru yang beralih dari [Node.js](https://nodejs.org/en/about/) ke [Go](https://golang.org/doc/) terkadang perlu waktu yang cukup lama sebelum mereka mampu membuat aplikasi berbasis web dengan Go. Fiber, sebagai **web framework** dirancang secara **minimalis** dan mengikuti filosofi dari **UNIX**, sehingga pengguna baru dengan cepat memasuki dunia Go dengan sambutan yang hangat dan dapat diandalkan. +Bagi yang baru yang beralih dari [Node.js](https://nodejs.org/en/about/) ke [Go](https://golang.org/doc/) terkadang perlu waktu yang cukup lama sebelum mereka mampu membuat aplikasi web dengan Go. Fiber, sebagai **web framework** dirancang secara **minimalis** dan mengikuti filosofi dari **UNIX**, sehingga pengguna baru dengan cepat memasuki dunia Go dengan sambutan yang hangat dan dapat diandalkan. Fiber terinspirasi dari Express, salah satu web framework paling terkenal di Internet. Kami menggabungkan **kemudahan** dari Express dan **kinerja luar biasa** dari Go. Apabila anda pernah membuat aplikasi dengan Node.js (_dengan Express atau yang lainnya_), maka banyak metode dan prinsip yang akan terasa **sangat umum** bagi anda. From c324ee4d864026440adddc781bd23585a025ce34 Mon Sep 17 00:00:00 2001 From: Zac Davis Date: Thu, 5 Mar 2020 09:50:22 -0500 Subject: [PATCH 08/26] Minor grammar fixes for README --- .github/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/README.md b/.github/README.md index 1734ac84..ef52bcf9 100644 --- a/.github/README.md +++ b/.github/README.md @@ -63,7 +63,7 @@

- Fiber is an Express inspired web framework build on top of Fasthttp, the fastest HTTP engine for Go. Designed to ease things up for fast development with zero memory allocation and performance in mind. + Fiber is an Express inspired web framework built on top of Fasthttp, the fastest HTTP engine for Go. Designed to ease things up for fast development with zero memory allocation and performance in mind.

## ⚡️ Quickstart @@ -117,11 +117,11 @@ These tests are performed by [TechEmpower](https://github.com/TechEmpower/Framew ## 💡 Philosophy -New gophers that make the switch from [Node.js](https://nodejs.org/en/about/) to [Go](https://golang.org/doc/) are dealing with a learning curve before they can 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 with a warm and trusted welcome. +New gophers that make the switch from [Node.js](https://nodejs.org/en/about/) to [Go](https://golang.org/doc/) are dealing with a learning curve before they can start building their web applications or microservices. Fiber, as a **web framework**, was created with the idea of **minimalism** and follows the **UNIX way**, so that new gophers can quickly enter the world of Go with a warm and trusted welcome. -Fiber is **inspired** by Express, the most popular web framework on the 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 or similar_), then many methods and principles will seem **very common** to you. +Fiber is **inspired** by Express, the most popular web framework on the Internet. We combined the **ease** of Express and **raw performance** of Go. If you have ever implemented a web application in Node.js (_using Express or similar_), then many methods and principles will seem **very common** to you. -We **listen** to our users in [issues](https://github.com/gofiber/fiber/issues) (_and all over the Internet_) to create a **fast**, **flexible** and **friendly** Go web framework for **any** tasks, **deadlines** and developer **skills**! Just like Express does in the JavaScript world. +We **listen** to our users in [issues](https://github.com/gofiber/fiber/issues) (_and all over the Internet_) to create a **fast**, **flexible** and **friendly** Go web framework for **any** task, **deadline** and developer **skill**! Just like Express does in the JavaScript world. ## 👀 Examples @@ -278,7 +278,7 @@ import ( func main() { app := fiber.New() - + // If you want to change default Logger config loggerConfig := middleware.LoggerConfig{ Format: "${time} - ${method} ${path}\n", @@ -317,7 +317,7 @@ func main() { } ``` -Check CORS by passing any domain in `Origin` header: +Check CORS by passing any domain in `Origin` header: ```bash curl -H "Origin: http://example.com" --verbose http://localhost:3000 @@ -422,7 +422,7 @@ func main() { log.Println(err) // "Something went wrong!" c.SendStatus(500) // Internal Server Error }))) - + app.Get("/", func(c *fiber.Ctx) { panic("Something went wrong!") }) From 79675954af150a03dfa83dbebcf024443a2f6bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 17:34:42 +0300 Subject: [PATCH 09/26] Update README.md --- .github/README.md | 138 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 102 insertions(+), 36 deletions(-) diff --git a/.github/README.md b/.github/README.md index ef52bcf9..f676e24a 100644 --- a/.github/README.md +++ b/.github/README.md @@ -4,37 +4,37 @@
- + - + - + - + - + - + - + - + - + - +

@@ -129,6 +129,12 @@ Listed below are some of the common examples. If you want to see more code examp ### Routing +Docs: + +- 📖 https://fiber.wiki/#basic-routing + +Example: + ```go func main() { app := fiber.New() @@ -156,7 +162,13 @@ func main() { ``` ### Serve static files -https://fiber.wiki/application#static + +Docs: + +- 📖 https://fiber.wiki/application#static + +Example: + ```go func main() { app := fiber.New() @@ -177,8 +189,14 @@ func main() { ``` ### Middleware & Next -https://fiber.wiki/routing#middleware -https://fiber.wiki/context#next + +Docs: + +- 📖 https://fiber.wiki/routing#middleware +- 📖 https://fiber.wiki/context#next + +Example: + ```go func main() { app := fiber.New() @@ -209,16 +227,22 @@ func main() { 📚 Show more code examples ### Template engines -https://fiber.wiki/application#settings -https://fiber.wiki/context#render + +Docs: + +- 📖 https://fiber.wiki/application#settings +- 📖 https://fiber.wiki/context#render Supported engines: + - [html](https://golang.org/pkg/html/template/) - [amber](https://github.com/eknkc/amber) - [handlebars](https://github.com/aymerick/raymond) - [mustache](https://github.com/cbroglie/mustache) - [pug](https://github.com/Joker/jade) +Example: + ```go func main() { // You can setup template engine before initiation app: @@ -246,7 +270,13 @@ func main() { ``` ### Grouping routes into chains -https://fiber.wiki/application#group + +Docs: + +- 📖 https://fiber.wiki/application#group + +Example: + ```go func main() { app := fiber.New() @@ -269,7 +299,13 @@ func main() { ``` ### Middleware logger -https://fiber.wiki/middleware#logger + +Docs: + +- 📖 https://fiber.wiki/middleware#logger + +Example: + ```go import ( "github.com/gofiber/fiber" @@ -293,9 +329,14 @@ func main() { ``` ### Cross-Origin Resource Sharing (CORS) -https://fiber.wiki/middleware#cors -[CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. A web application executes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, or port) from its own. +Docs: + +- 📖 https://fiber.wiki/middleware#cors + +> [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. A web application executes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, or port) from its own. + +Example: ```go import ( @@ -310,7 +351,7 @@ func main() { app.Use(middleware.CORS()) app.Get("/", func(c *fiber.Ctx) { - c.Send("CORS is enabled!") + c.Send("CORS is enabled!") }) app.Listen(3000) @@ -325,6 +366,12 @@ curl -H "Origin: http://example.com" --verbose http://localhost:3000 ### Custom 404 response +Docs: + +- 📖 https://fiber.wiki/application#http-methods + +Example: + ```go func main() { app := fiber.New() @@ -341,7 +388,8 @@ func main() { // Last middleware to match anything app.Use(func(c *fiber.Ctx) { - c.SendStatus(404) // => 404 "Not Found" + c.SendStatus(404) + // => 404 "Not Found" }) app.Listen(3000) @@ -349,7 +397,13 @@ func main() { ``` ### JSON Response -https://fiber.wiki/context#json + +Docs: + +- 📖 https://fiber.wiki/context#json + +Example: + ```go type User struct { Name string `json:"name"` @@ -361,15 +415,15 @@ func main() { app.Get("/user", func(c *fiber.Ctx) { c.JSON(&User{"John", 20}) - // {"name":"John", "age":20} + // => {"name":"John", "age":20} }) app.Get("/json", func(c *fiber.Ctx) { - c.JSON(&fiber.Map{ - "success": true, - "message": "Hi John!", + c.JSON(fiber.Map{ + "success": true, + "message": "Hi John!", }) - // {"success":true, "message":"Hi John!"} + // => {"success":true, "message":"Hi John!"} }) app.Listen(3000) @@ -377,7 +431,13 @@ func main() { ``` ### WebSocket support -https://fiber.wiki/application#websocket + +Docs: + +- 📖 https://fiber.wiki/application#websocket + +Example: + ```go func main() { app := fiber.New() @@ -406,7 +466,13 @@ func main() { ``` ### Recover middleware -https://fiber.wiki/middleware#recover + +Docs: + +- 📖 https://fiber.wiki/middleware#recover + +Example: + ```go package main @@ -455,12 +521,6 @@ If you want to say **thank you** and/or support the active development of `Fiber - +
- -
- JustDave -
-

@@ -485,6 +545,12 @@ If you want to say **thank you** and/or support the active development of `Fiber ToishY
+ +
+ JustDave +
+
From 06b98e43a813a95b884b28d63f4766ae77f24b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 17:41:00 +0300 Subject: [PATCH 10/26] Update README.md --- .github/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/README.md b/.github/README.md index f676e24a..e932534b 100644 --- a/.github/README.md +++ b/.github/README.md @@ -474,8 +474,6 @@ Docs: Example: ```go -package main - import ( "github.com/gofiber/fiber" "github.com/gofiber/fiber/middleware" @@ -487,7 +485,7 @@ func main() { app.Use(middleware.Recover(func(c *fiber.Ctx, err error) { log.Println(err) // "Something went wrong!" c.SendStatus(500) // Internal Server Error - }))) + })) app.Get("/", func(c *fiber.Ctx) { panic("Something went wrong!") From d2a3e8f5f9606f49b0018469b75f898e6a0d8374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 17:43:17 +0300 Subject: [PATCH 11/26] Update README.md --- .github/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/README.md b/.github/README.md index e932534b..f070914c 100644 --- a/.github/README.md +++ b/.github/README.md @@ -500,6 +500,7 @@ func main() { - [Welcome to Fiber — an Express.js styled web framework written in Go with ❤️](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) (_by [Vic Shóstak](https://github.com/koddr), 03 Feb 2020_) - [Fiber release v1.7 is out now! 🎉 What's new and is he still fast, flexible and friendly?](https://dev.to/koddr/fiber-v2-is-out-now-what-s-new-and-is-he-still-fast-flexible-and-friendly-3ipf) (_by [Vic Shóstak](https://github.com/koddr), 21 Feb 2020_) +- [🚀 Fiber v1.8. What's new, updated and re-thinked?](https://dev.to/koddr/fiber-v1-8-what-s-new-updated-and-re-thinked-339h) (_by [Vic Shóstak](https://github.com/koddr), 03 Mar 2020_) ## 👍 Contribute From 3d6c69feda66a640f5d41594db79fc3f5037f5d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 19:29:32 +0300 Subject: [PATCH 12/26] Update README.md --- .github/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index f070914c..1eaa464c 100644 --- a/.github/README.md +++ b/.github/README.md @@ -125,7 +125,9 @@ We **listen** to our users in [issues](https://github.com/gofiber/fiber/issues) ## 👀 Examples -Listed below are some of the common examples. If you want to see more code examples, please visit our [Recipes repository](https://github.com/gofiber/recipes) or visit our [API documentation](https://fiber.wiki). +Listed below are some of the common examples. + +> If you want to see more code examples, please visit our [Recipes repository](https://github.com/gofiber/recipes) or visit our [API documentation](https://fiber.wiki). ### Routing From fcd4c9ec6d1d5241427483a5a3cca0759b9b2a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 22:05:33 +0300 Subject: [PATCH 13/26] Update README_de.md --- .github/README_de.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/README_de.md b/.github/README_de.md index 60713867..74918120 100644 --- a/.github/README_de.md +++ b/.github/README_de.md @@ -4,37 +4,37 @@

- + - + - + - + - + - + - + - + - + - +

From 2d6aca44c49f9e2abef2fdd2793259deb8b18c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 22:15:03 +0300 Subject: [PATCH 14/26] Update README_es.md --- .github/README_es.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/README_es.md b/.github/README_es.md index 693d4c12..a658c6ab 100644 --- a/.github/README_es.md +++ b/.github/README_es.md @@ -4,37 +4,37 @@
- + - + - + - + - + - + - + - + - + - +

@@ -450,12 +450,6 @@ Si quiere **agradecer** y/o apoyar el desarrollo activo de la `Fiber`: - +
- -
- JustDave -
-

@@ -480,6 +474,12 @@ Si quiere **agradecer** y/o apoyar el desarrollo activo de la `Fiber`: ToishY
+ +
+ JustDave +
+
From 28ca1835eedde07a812f81ad276a2208464e4cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 22:17:27 +0300 Subject: [PATCH 15/26] Update README_fr.md --- .github/README_fr.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/README_fr.md b/.github/README_fr.md index 508c728a..37dacfa1 100644 --- a/.github/README_fr.md +++ b/.github/README_fr.md @@ -4,37 +4,37 @@
- + - + - + - + - + - + - + - + - + - + - +

@@ -450,12 +450,6 @@ Si vous voulez nous remercier et/ou soutenir le développement actif de `Fiber`: - +
- -
- JustDave -
-

@@ -480,6 +474,12 @@ Si vous voulez nous remercier et/ou soutenir le développement actif de `Fiber`: ToishY
+ +
+ JustDave +
+
From 51aed2295566f2a3896ed838108a46c953671836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 22:19:05 +0300 Subject: [PATCH 16/26] Update README_id.md --- .github/README_id.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/README_id.md b/.github/README_id.md index 3e9a0bd2..1b7363e9 100644 --- a/.github/README_id.md +++ b/.github/README_id.md @@ -4,38 +4,38 @@
- + - + - + - + - + - + - + - + - + - + - +

@@ -455,12 +455,6 @@ Apabila anda ingin mengucapkan **terima kasih** dan/atau mendukung pengembangan - +
- -
- JustDave -
-

@@ -485,6 +479,12 @@ Apabila anda ingin mengucapkan **terima kasih** dan/atau mendukung pengembangan ToishY
+ +
+ JustDave +
+
From c6b620fa8d08f65d371e252a12dc42ebc2111455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 22:20:19 +0300 Subject: [PATCH 17/26] Update README_ja.md --- .github/README_ja.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/README_ja.md b/.github/README_ja.md index 405c00d2..bf612cad 100644 --- a/.github/README_ja.md +++ b/.github/README_ja.md @@ -4,37 +4,37 @@

- + - + - + - + - + - + - + - + - + - +

@@ -456,12 +456,6 @@ func main() { - +
- -
- JustDave -
-

@@ -486,6 +480,12 @@ func main() { ToishY
+ +
+ JustDave +
+
From ada2c2f15b45b1d08614541f511eeba0dbff8358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 22:21:19 +0300 Subject: [PATCH 18/26] Update README_ko.md --- .github/README_ko.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/README_ko.md b/.github/README_ko.md index 26437de6..7a300be6 100644 --- a/.github/README_ko.md +++ b/.github/README_ko.md @@ -4,37 +4,37 @@
- + - + - + - + - + - + - + - + - + - +

@@ -450,12 +450,6 @@ func main() { - +
- -
- JustDave -
-

@@ -480,6 +474,12 @@ func main() { ToishY
+ +
+ JustDave +
+
From 8155f43748a51815b35504f999b17e7890538dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 22:22:52 +0300 Subject: [PATCH 19/26] Update README_pt.md --- .github/README_pt.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/README_pt.md b/.github/README_pt.md index 11f362bf..1ee27c1d 100644 --- a/.github/README_pt.md +++ b/.github/README_pt.md @@ -4,37 +4,37 @@
- + - + - + - + - + - + - + - + - + - +

@@ -450,12 +450,6 @@ Se você quer **agradecer** e/ou apoiar o desenvolvimento ativo do `Fiber`: - +
- -
- JustDave -
-

@@ -480,6 +474,12 @@ Se você quer **agradecer** e/ou apoiar o desenvolvimento ativo do `Fiber`: ToishY
+ +
+ JustDave +
+
From 0f46a97c2569ecf47007d1b51253cfb2f6b89414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 22:37:33 +0300 Subject: [PATCH 20/26] Update README_ru.md --- .github/README_ru.md | 104 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 86 insertions(+), 18 deletions(-) diff --git a/.github/README_ru.md b/.github/README_ru.md index 70c62950..4d2bc444 100644 --- a/.github/README_ru.md +++ b/.github/README_ru.md @@ -4,37 +4,37 @@
- + - + - + - + - + - + - + - + - + - +

@@ -129,6 +129,12 @@ Fiber **вдохновлен** Express, самым популярным веб ### Роутинг +Документация: + +- 📖 https://fiber.wiki/#basic-routing + +Пример: + ```go func main() { app := fiber.New() @@ -157,6 +163,12 @@ func main() { ### Обслуживание статичных файлов +Документация: + +- 📖 https://fiber.wiki/application#static + +Пример: + ```go func main() { app := fiber.New() @@ -178,6 +190,13 @@ func main() { ### Middleware и функция Next +Документация: + +- 📖 https://fiber.wiki/routing#middleware +- 📖 https://fiber.wiki/context#next + +Пример: + ```go func main() { app := fiber.New() @@ -209,6 +228,11 @@ func main() { ### Работа с шаблонами +Документация: + +- 📖 https://fiber.wiki/application#settings +- 📖 https://fiber.wiki/context#render + Поддерживаемые движки шаблонов: - [html](https://golang.org/pkg/html/template/) @@ -217,6 +241,8 @@ func main() { - [mustache](https://github.com/cbroglie/mustache) - [pug](https://github.com/Joker/jade) +Пример: + ```go func main() { // Вы можете настроить нужный движок для шаблонов @@ -247,6 +273,12 @@ func main() { ### Группировка роутов в цепочки +Документация: + +- 📖 https://fiber.wiki/application#group + +Пример: + ```go func main() { app := fiber.New() @@ -270,6 +302,12 @@ func main() { ### Встроенный логгер +Документация: + +- 📖 https://fiber.wiki/middleware#logger + +Пример: + ```go import ( "github.com/gofiber/fiber" @@ -294,7 +332,13 @@ func main() { ### Cross-Origin Resource Sharing (CORS) -[CORS](https://developer.mozilla.org/ru/docs/Web/HTTP/CORS) — это механизм, использующий дополнительные HTTP-заголовки, чтобы дать возможность агенту пользователя получать разрешения на доступ к выбранным ресурсам с сервера на источнике (домене), отличном от того, что сайт использует в данный момент. +Документация: + +- 📖 https://fiber.wiki/middleware#cors + +> [CORS](https://developer.mozilla.org/ru/docs/Web/HTTP/CORS) — это механизм, использующий дополнительные HTTP-заголовки, чтобы дать возможность агенту пользователя получать разрешения на доступ к выбранным ресурсам с сервера на источнике (домене), отличном от того, что сайт использует в данный момент. + +Пример: ```go import ( @@ -324,6 +368,12 @@ curl -H "Origin: http://example.com" --verbose http://localhost:3000 ### Обработка 404 ошибки +Документация: + +- 📖 https://fiber.wiki/application#http-methods + +Пример: + ```go func main() { app := fiber.New() @@ -349,6 +399,12 @@ func main() { ### Ответ в формате JSON +Документация: + +- 📖 https://fiber.wiki/context#json + +Пример: + ```go func main() { app := fiber.New() @@ -370,6 +426,12 @@ func main() { ### Поддержка WebSocket +Документация: + +- 📖 https://fiber.wiki/application#websocket + +Пример: + ```go func main() { app := fiber.New() @@ -401,6 +463,12 @@ func main() { ### Восстановление работы после `panic` +Документация: + +- 📖 https://fiber.wiki/middleware#recover + +Пример: + ```go func main() { app := fiber.New() @@ -441,12 +509,6 @@ func main() { - +
- -
- JustDave -
-

@@ -471,6 +533,12 @@ func main() { ToishY
+ +
+ JustDave +
+
From b0c3ef8dc0aa5f403b5c632c68f50e29c569c935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 22:41:14 +0300 Subject: [PATCH 21/26] Update README_ru.md --- .github/README_ru.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/README_ru.md b/.github/README_ru.md index 4d2bc444..53c92205 100644 --- a/.github/README_ru.md +++ b/.github/README_ru.md @@ -492,6 +492,7 @@ func main() { - [Welcome to Fiber — an Express.js styled web framework written in Go with ❤️](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) (_by [Vic Shóstak](https://github.com/koddr), 03 Feb 2020_) - [Fiber release v1.7 is out now! 🎉 What's new and is he still fast, flexible and friendly?](https://dev.to/koddr/fiber-v2-is-out-now-what-s-new-and-is-he-still-fast-flexible-and-friendly-3ipf) (_by [Vic Shóstak](https://github.com/koddr), 21 Feb 2020_) +- [🚀 Fiber v1.8. What's new, updated and re-thinked?](https://dev.to/koddr/fiber-v1-8-what-s-new-updated-and-re-thinked-339h) (_by [Vic Shóstak](https://github.com/koddr), 03 Mar 2020_) ## 👍 Помощь проекту From 53617b0a57c3c12222fbb1b2e7052af7040477b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 22:45:00 +0300 Subject: [PATCH 22/26] Update README_tr.md --- .github/README_tr.md | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/README_tr.md b/.github/README_tr.md index a720acd9..1e54a5e5 100644 --- a/.github/README_tr.md +++ b/.github/README_tr.md @@ -4,34 +4,37 @@
- + - + - + - + - + - + - + - + - + + - +

@@ -449,12 +452,6 @@ Eğer **teşekkür etmek** ve/veya `Fiber` ın aktif geliştirilmesini destekle - +
- -
- JustDave -
-

@@ -479,6 +476,12 @@ Eğer **teşekkür etmek** ve/veya `Fiber` ın aktif geliştirilmesini destekle ToishY
+ +
+ JustDave +
+
From e7663be2df0ed944d43e48e14cfc0f43171ffdca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vic=20Sh=C3=B3stak?= Date: Sat, 7 Mar 2020 22:47:00 +0300 Subject: [PATCH 23/26] Update README_zh-CN.md --- .github/README_zh-CN.md | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/README_zh-CN.md b/.github/README_zh-CN.md index 06cb4562..707b6c62 100644 --- a/.github/README_zh-CN.md +++ b/.github/README_zh-CN.md @@ -4,34 +4,37 @@

- + - + - + - + - + - + - + - + + + + - +

@@ -448,12 +451,6 @@ func main() { - +
- -
- JustDave -
-

@@ -478,6 +475,12 @@ func main() { ToishY
+ +
+ JustDave +
+
From 225bbdb1313b72fd0870c98bf2f3f7db0423deaf Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Tue, 10 Mar 2020 14:32:21 +0800 Subject: [PATCH 24/26] fix bug of Prefork --- app.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.go b/app.go index 257cafc7..4a9bc327 100644 --- a/app.go +++ b/app.go @@ -73,10 +73,10 @@ func init() { func New(settings ...*Settings) *App { var prefork, child bool // Loop trought args without using flag.Parse() - for i := range os.Args[1:] { - if os.Args[i] == "-prefork" { + for _, v := range os.Args[1:] { + if v == "-prefork" { prefork = true - } else if os.Args[i] == "-child" { + } else if v == "-child" { child = true } } From ff815a07994aeab057c1fcbd0df68eed372357a5 Mon Sep 17 00:00:00 2001 From: Ruwan Egodawatte <617196+ruwanego@users.noreply.github.com> Date: Wed, 11 Mar 2020 10:10:09 +0530 Subject: [PATCH 25/26] Fixed a small typo --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 5bc12703..f134ba73 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019-present Fenny and Fiber Contributers +Copyright (c) 2019-present Fenny and Fiber Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From d2b51c521cc06c95c620d79a37fee97f3354c1e1 Mon Sep 17 00:00:00 2001 From: Fenny Date: Fri, 13 Mar 2020 14:27:40 -0400 Subject: [PATCH 26/26] .. --- app.go | 5 ----- go.mod | 4 ++++ go.sum | 7 +++++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app.go b/app.go index 4a9bc327..144b531c 100644 --- a/app.go +++ b/app.go @@ -64,11 +64,6 @@ type ( } ) -func init() { - flag.Bool("prefork", false, "Use prefork") - flag.Bool("child", false, "Is a child process") -} - // New : https://fiber.wiki/application#new func New(settings ...*Settings) *App { var prefork, child bool diff --git a/go.mod b/go.mod index 7c2bf8f2..6f89cfee 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,10 @@ require ( github.com/google/uuid v1.1.1 github.com/gorilla/schema v1.1.0 github.com/json-iterator/go v1.1.9 + github.com/klauspost/compress v1.10.2 // indirect + github.com/klauspost/cpuid v1.2.3 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect github.com/valyala/fasthttp v1.9.0 github.com/valyala/fasttemplate v1.1.0 ) diff --git a/go.sum b/go.sum index 425a50ac..78a976e2 100644 --- a/go.sum +++ b/go.sum @@ -22,12 +22,19 @@ github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGn github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/klauspost/compress v1.8.2 h1:Bx0qjetmNjdFXASH02NSAREKpiaDwkO1DRZ3dV2KCcs= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.10.2 h1:Znfn6hXZAHaLPNnlqUYRrBSReFHYybslgv4PTiyz6P0= +github.com/klauspost/compress v1.10.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/savsgio/gotils v0.0.0-20200117113501-90175b0fbe3f h1:PgA+Olipyj258EIEYnpFFONrrCcAIWNUNoFhUfMqAGY= github.com/savsgio/gotils v0.0.0-20200117113501-90175b0fbe3f/go.mod h1:lHhJedqxCoHN+zMtwGNTXWmF0u9Jt363FYRhV6g0CdY=