1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-21 19:32:58 +00:00

Add files via upload

This commit is contained in:
Fenny 2020-05-13 00:56:23 +02:00 committed by GitHub
parent 4d7fdf5cf0
commit ded56306b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 7691 additions and 0 deletions

81
.github/CODE_OF_CONDUCT.md vendored Normal file
View File

@ -0,0 +1,81 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [Gitter](https://gitter.im/gofiber/community). All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of actions.
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

28
.github/CONTRIBUTING.md vendored Normal file
View File

@ -0,0 +1,28 @@
# Contributing
When contributing to this repository, please first discuss the change you wish to make via our [Telegram](https://t.me/gofiber) group, by creating an [issue](https://github.com/gofiber/fiber/issues) or any other method with the owners of this repository before making a change.
Please note: we have a [code of conduct](https://github.com/gofiber/fiber/blob/master/.github/CODE_OF_CONDUCT.md), please follow it in all your interactions with the `Fiber` project.
## Pull Requests or Comits
Titles always we must use prefix according to below:
> 🔥 Feature, ♻️ Refactor, 🩹 Fix, 🚨 Test, 📚 Doc, 🎨 Style
- 🔥 Feature: Add flow to add person
- ♻️ Refactor: Rename file X to Y
- 🩹 Fix: Improve flow
- 🚨 Test: Validate to add a new person
- 📚 Doc: Translate to Portuguese middleware redirect
- 🎨 Style: Respected pattern Golint
All pull request that contains a feature or fix is mandatory to have unit tests. Your PR is only to be merged if you respect this flow.
# 👍 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 our API Documentation via [Crowdin](https://crowdin.com/project/gofiber) [![Crowdin](https://badges.crowdin.net/gofiber/localized.svg)](https://crowdin.com/project/gofiber)
5. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).

8
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,8 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: https://www.buymeacoffee.com/fenny

27
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: "🐞 "
labels: bug
assignees: ""
---
**Fiber version/commit**
**Issue description**
**Expected behavior**
**Steps to reproduce**
**Code snippet**
```go
package main
import "github.com/gofiber/fiber"
func main() {
app := fiber.New()
// ..
}
```

View File

@ -0,0 +1,15 @@
---
name: Feature request
about: Suggest an idea for this project
title: "🔥 "
labels: enhancement
assignees: ""
---
**Is your feature request related to a problem?**
**Describe the solution you'd like**
**Describe alternatives you've considered**
**Additional context**

21
.github/ISSUE_TEMPLATE/question.md vendored Normal file
View File

@ -0,0 +1,21 @@
---
name: Question
about: Ask a question so we can help
title: "🤔 "
labels: question
assignees: ""
---
**Question description**
**Code snippet (optional)**
```go
package main
import "github.com/gofiber/fiber"
func main() {
app := fiber.New()
// ..
}
```

View File

@ -0,0 +1,9 @@
**Fixes issue:** #
**Changes proposed in this pull request:**
-
-
-
**Additional context:**

556
.github/README.md vendored Normal file
View File

@ -0,0 +1,556 @@
<p align="center">
<a href="https://gofiber.io">
<img alt="Fiber" height="125" src="https://github.com/gofiber/docs/blob/master/static/fiber_v2_logo.svg">
</a>
<br>
<!--<a href="https://github.com/gofiber/fiber/blob/master/.github/README.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/en.svg">
</a>-->
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ru.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ru.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_es.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/es.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ja.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/jp.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_pt.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/pt.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_zh-CN.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ch.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_fr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/fr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_tr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/tr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_id.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/id.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_he.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/il.svg">
</a>
<br><br>
<a href="https://github.com/gofiber/fiber/releases">
<img src="https://img.shields.io/github/release/gofiber/fiber?style=flat-square">
</a>
<a href="https://docs.gofiber.io">
<img src="https://img.shields.io/badge/api-docs-blue?style=flat-square">
</a>
<a href="https://pkg.go.dev/github.com/gofiber/fiber?tab=doc">
<img src="https://img.shields.io/badge/go.dev-007d9c?logo=go&logoColor=white&style=flat-square">
</a>
<a href="https://goreportcard.com/report/github.com/gofiber/fiber">
<img src="https://goreportcard.com/badge/github.com/gofiber/fiber?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ATest">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Test?label=tests&style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3AGosec">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Gosec?label=gosec&style=flat-square">
</a>
<a href="https://gofiber.io/discord">
<img src="https://img.shields.io/badge/discord-join%20channel-7289DA?style=flat-square">
</a>
</p>
<p align="center">
<b>Fiber</b> is an <a href="https://github.com/expressjs/express">Express</a> inspired <b>web framework</b> built on top of <a href="https://github.com/valyala/fasthttp">Fasthttp</a>, the <b>fastest</b> HTTP engine for <a href="https://golang.org/doc/">Go</a>. Designed to <b>ease</b> things up for <b>fast</b> development with <b>zero memory allocation</b> and <b>performance</b> in mind.
</p>
## ⚡️ 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://docs.gofiber.io/benchmarks).
<p float="left" align="middle">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark-pipeline.png" width="49%">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark_alloc.png" width="49%">
</p>
## 🎯 Features
- Robust [routing](https://docs.gofiber.io/routing)
- Serve [static files](https://docs.gofiber.io/application#static)
- Extreme [performance](https://docs.gofiber.io/benchmarks)
- [Low memory](https://docs.gofiber.io/benchmarks) footprint
- [API endpoints](https://docs.gofiber.io/context)
- [Middleware](https://docs.gofiber.io/middleware) & [Next](https://docs.gofiber.io/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
- [Template engines](https://docs.gofiber.io/middleware#template)
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
- Translated in [12 other languages](https://docs.gofiber.io/)
- And much more, [explore Fiber](https://docs.gofiber.io/)
## 💡 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 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 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), Discord [channel](https://gofiber.io/discord) _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
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://docs.gofiber.io).
### Routing
📖 [Routing](https://docs.gofiber.io/#basic-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
📖 [Static](https://docs.gofiber.io/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
📖 [Middleware](https://docs.gofiber.io/routing#middleware)
📖 [Next](https://docs.gofiber.io/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()
})
// GET /api/register
app.Get("/api/list", func(c *fiber.Ctx) {
fmt.Println("Last middleware")
c.Send("Hello, World!")
})
app.Listen(3000)
}
```
<details>
<summary>📚 Show more code examples</summary>
### Template engines
📖 [Settings](https://docs.gofiber.io/application#settings)
📖 [Render](https://docs.gofiber.io/context#render)
📖 [Template](https://docs.gofiber.io/middleware#template)
Fiber supports the default [Go template engine](https://golang.org/pkg/html/template/)
But if you want to use another template engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade).
You can use our [Template Middleware](https://docs.gofiber.io/middleware#template).
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/template"
)
func main() {
// You can setup template engine before initiation app:
app := fiber.New(&fiber.Settings{
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})
// OR after initiation app at any convenient location:
app.Settings.TemplateEngine = template.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
📖 [Group](https://docs.gofiber.io/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
📖 [Logger](https://docs.gofiber.io/middleware#logger)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/logger"
)
func main() {
app := fiber.New()
// Optional logger config
config := logger.Config{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Logger with config
app.Use(logger.New(config))
app.Listen(3000)
}
```
### Cross-Origin Resource Sharing (CORS)
📖 [CORS](https://docs.gofiber.io/middleware#cors)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/cors"
)
func main() {
app := fiber.New()
// CORS with default config
app.Use(cors.New())
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
📖 [HTTP Methods](https://docs.gofiber.io/application#http-methods)
```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
📖 [JSON](https://docs.gofiber.io/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 Upgrade
📖 [Websocket](https://docs.gofiber.io/middleware#websocket)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
app.Get("/ws", websocket.New(func(c *websocket.Conn) {
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
log.Printf("recv: %s", msg)
err = c.WriteMessage(mt, msg)
if err != nil {
log.Println("write:", err)
break
}
}
}))
app.Listen(3000)
// ws://localhost:3000/ws
}
```
### Recover middleware
📖 [Recover](https://docs.gofiber.io/middleware#recover)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/recover"
)
func main() {
app := fiber.New()
// Optional recover config
config := recover.Config{
Handler: func(c *fiber.Ctx, err error) {
c.SendString(err.Error())
c.SendStatus(500)
},
}
// Logger with custom config
app.Use(recover.New(config))
app.Listen(3000)
}
```
</details>
## 🧬 Official Middlewares
For an more _maintainable_ middleware _ecosystem_, we've put official [middlewares](https://docs.gofiber.io/middleware) into separate repositories:
- [gofiber/compression](https://github.com/gofiber/compression)
- [gofiber/basicauth](https://github.com/gofiber/basicauth)
- [gofiber/requestid](https://github.com/gofiber/requestid)
- [gofiber/websocket](https://github.com/gofiber/websocket)
- [gofiber/keyauth](https://github.com/gofiber/keyauth)
- [gofiber/rewrite](https://github.com/gofiber/rewrite)
- [gofiber/recover](https://github.com/gofiber/recover)
- [gofiber/limiter](https://github.com/gofiber/limiter)
- [gofiber/session](https://github.com/gofiber/session)
- [gofiber/adaptor](https://github.com/gofiber/adaptor)
- [gofiber/logger](https://github.com/gofiber/logger)
- [gofiber/helmet](https://github.com/gofiber/helmet)
- [gofiber/embed](https://github.com/gofiber/embed)
- [gofiber/pprof](https://github.com/gofiber/pprof)
- [gofiber/cors](https://github.com/gofiber/cors)
- [gofiber/csrf](https://github.com/gofiber/csrf)
- [gofiber/jwt](https://github.com/gofiber/jwt)
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
## 💬 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) — _03 Feb 2020_
- [Fiber released v1.7! 🎉 What's new and is it 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) — _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) — _03 Mar 2020_
- [Is switching from Express to Fiber worth it? 🤔](https://dev.to/koddr/are-sure-what-your-lovely-web-framework-running-so-fast-2jl1) — _01 Apr 2020_
- [Creating Fast APIs In Go Using Fiber](https://dev.to/jozsefsallai/creating-fast-apis-in-go-using-fiber-59m9) — _07 Apr 2020_
- [Building a Basic REST API in Go using Fiber](https://tutorialedge.net/golang/basic-rest-api-go-fiber/) - _23 Apr 2020_
- [📺 Building a REST API using GORM and Fiber](https://youtu.be/Iq2qT0fRhAA) - _25 Apr 2020_
- [🌎 Create a travel list app with Go, Fiber, Angular, MongoDB and Google Cloud Secret Manager](https://blog.yongweilun.me/create-a-travel-list-app-with-go-fiber-angular-mongodb-and-google-cloud-secret-manager-ck9fgxy0p061pcss1xt1ubu8t) - _25 Apr 2020_
- [Fiber v1.9.6 🔥 How to improve performance by 817% and stay fast, flexible and friendly?](https://dev.to/koddr/fiber-v1-9-5-how-to-improve-performance-by-817-and-stay-fast-flexible-and-friendly-2dp6) - _12 May 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=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%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 our API Documentation via [Crowdin](https://crowdin.com/project/gofiber) [![Crowdin](https://badges.crowdin.net/gofiber/localized.svg)](https://crowdin.com/project/gofiber)
5. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).
## ☕ Supporters
Fiber is an open source project that runs on donations to pay the bills e.g. our domain name, gitbook, netlify and serverless hosting. If you want to support Fiber, you can ☕ [**buy a coffee here**](https://buymeacoff.ee/fenny).
| | User | Donation |
| :---------------------------------------------------------- | :---------------------------------------------- | :------- |
| ![](https://avatars.githubusercontent.com/u/59947262?s=25 ) | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/1094221?s=25 ) | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/186637?s=25 ) | [@candidosales](https://github.com/candidosales)| ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/635852?s=25 ) | [@bihe](https://github.com/bihe) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/307334?s=25 ) | [@justdave](https://github.com/justdave) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/11155743?s=25 ) | [@koddr](https://github.com/koddr) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/29042462?s=25 ) | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/2978730?s=25 ) | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/44171355?s=25 ) | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/5638101?s=25 ) | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/619996?s=25 ) | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31022056?s=25 ) | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31921460?s=25 ) | [@toishy](https://github.com/toishy) | ☕ x 1 |
## ‎‍💻 Code Contributors
<img src="https://opencollective.com/fiber/contributors.svg?width=890&button=false" alt="Code Contributors" style="max-width:100%;">
## ⚠️ License
Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) license (CC BY-SA 4.0 International).
**Third-party library licenses**
- [FastHTTP](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [Schema](https://github.com/gorilla/schema/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)

552
.github/README_de.md vendored Normal file
View File

@ -0,0 +1,552 @@
<p align="center">
<a href="https://gofiber.io">
<img alt="Fiber" height="125" src="https://github.com/gofiber/docs/blob/master/static/fiber_v2_logo.svg">
</a>
<br>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/en.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ru.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ru.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_es.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/es.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ja.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/jp.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_pt.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/pt.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_zh-CN.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ch.svg">
</a>
<!--<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>-->
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_fr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/fr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_tr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/tr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_id.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/id.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_he.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/il.svg">
</a>
<br><br>
<a href="https://github.com/gofiber/fiber/releases">
<img src="https://img.shields.io/github/release/gofiber/fiber?style=flat-square">
</a>
<a href="https://docs.gofiber.io">
<img src="https://img.shields.io/badge/api-docs-blue?style=flat-square">
</a>
<a href="https://pkg.go.dev/github.com/gofiber/fiber?tab=doc">
<img src="https://img.shields.io/badge/go.dev-007d9c?logo=go&logoColor=white&style=flat-square">
</a>
<a href="https://goreportcard.com/report/github.com/gofiber/fiber">
<img src="https://goreportcard.com/badge/github.com/gofiber/fiber?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ATest">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Test?label=tests&style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3AGosec">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Gosec?label=gosec&style=flat-square">
</a>
<a href="https://gofiber.io/discord">
<img src="https://img.shields.io/badge/discord-join%20channel-7289DA?style=flat-square">
</a>
</p>
<p align="center">
<strong>Fiber</strong> ist ein von <a href="https://github.com/expressjs/express">Expressjs</a> inspiriertes <strong>Web-Framework</strong>, aufgebaut auf <a href="https://github.com/valyala/fasthttp">Fasthttp</a> - die <strong>schnellste</strong> HTTP engine für <a href="https://golang.org/doc/">Go</a>. Kreiert um Dinge zu <strong>vereinfachen</strong>, für <strong>schnelle</strong> Entwicklung mit <strong>keinen Speicherzuweisungen</strong> und <strong>Performance</strong> im Hinterkopf.
</p>
## ⚡️ Schnellstart
```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
Als erstes, [downloade](https://golang.org/dl/) und installiere Go. `1.11` oder höher.
Die Installation wird durch das [`go get`](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) Kommando gestartet:
```bash
go get -u github.com/gofiber/fiber
```
## 🤖 Benchmarks
Diese Tests wurden von [TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks) und [Go Web](https://github.com/smallnest/go-web-framework-benchmark) ausgeführt. Falls du alle Resultate sehen möchtest, besuche bitte unser [Wiki](https://docs.gofiber.io/benchmarks).
<p float="left" align="middle">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark-pipeline.png" width="49%">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark_alloc.png" width="49%">
</p>
## 🎯 Eigenschaften
- Robustes [Routing](https://docs.gofiber.io/routing)
- Bereitstellen von [statischen Dateien](https://docs.gofiber.io/application#static)
- Extreme [Performance](https://docs.gofiber.io/benchmarks)
- [Geringe Arbeitsspeicher](https://docs.gofiber.io/benchmarks) verwendung
- Express [API Endpunkte](https://docs.gofiber.io/context)
- [Middleware](https://docs.gofiber.io/middleware) & [Next](https://docs.gofiber.io/context#next) Support
- [Schnelle](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) serverseitige Programmierung
- [Template engines](https://docs.gofiber.io/middleware#template)
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
- Available in [12 languages](https://docs.gofiber.io/)
- Und vieles mehr - [erkunde Fiber](https://docs.gofiber.io/)
## 💡 Philosophie
Neue gopher welche von [Node.js](https://nodejs.org/en/about/) zu [Go](https://golang.org/doc/) umsteigen, müssen eine Lernkurve durchlaufen, bevor sie ihre Webanwendungen oder Microservices erstellen können. Fiber, als ein **Web-Framework**, wurde erschaffen mit der Idee von **Minimalismus** und folgt dem **UNIX Weg** damit neue Gophers mit einem herzlichen und vertrauenswürdigen Willkommen schnell in die Welt von Go eintreten können.
Fiber ist **inspiriert** von Expressjs, dem beliebtesten Web-Framework im Internet. Wir haben die **Leichtigkeit** von Express und die **Rohleistung** von Go kombiniert. Wenn du jemals eine Webanwendung mit Node.js implementiert hast (_mit Express.js oder ähnlichem_), werden dir viele Methoden und Prinzipien **sehr vertraut** vorkommen.
## 👀 Beispiele
Nachfolgend sind einige der gängigen Beispiele aufgeführt. Wenn du weitere Codebeispiele sehen möchten, besuche bitte unser ["Recipes Repository"](https://github.com/gofiber/recipes) oder besuche unsere [API Dokumentation](https://docs.gofiber.io).
### Routing
📖 [Routing](https://docs.gofiber.io/#basic-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
📖 [Static](https://docs.gofiber.io/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
📖 [Middleware](https://docs.gofiber.io/routing#middleware)
📖 [Next](https://docs.gofiber.io/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()
})
// GET /api/register
app.Get("/api/list", func(c *fiber.Ctx) {
fmt.Println("Last middleware")
c.Send("Hello, World!")
})
app.Listen(3000)
}
```
<details>
<summary>📚 Show more code examples</summary>
### Template engines
📖 [Settings](https://docs.gofiber.io/application#settings)
📖 [Render](https://docs.gofiber.io/context#render)
📖 [Template](https://docs.gofiber.io/middleware#template)
Fiber supports the default [Go template engine](https://golang.org/pkg/html/template/)
But if you want to use another template engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade).
You can use our [Template Middleware](https://docs.gofiber.io/middleware#template).
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/template"
)
func main() {
// You can setup template engine before initiation app:
app := fiber.New(&fiber.Settings{
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})
// OR after initiation app at any convenient location:
app.Settings.TemplateEngine = template.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
📖 [Group](https://docs.gofiber.io/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
📖 [Logger](https://docs.gofiber.io/middleware#logger)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/logger"
)
func main() {
app := fiber.New()
// Optional logger config
config := logger.Config{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Logger with config
app.Use(logger.New(config))
app.Listen(3000)
}
```
### Cross-Origin Resource Sharing (CORS)
📖 [CORS](https://docs.gofiber.io/middleware#cors)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/cors"
)
func main() {
app := fiber.New()
// CORS with default config
app.Use(cors.New())
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
📖 [HTTP Methods](https://docs.gofiber.io/application#http-methods)
```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
📖 [JSON](https://docs.gofiber.io/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 Upgrade
📖 [Websocket](https://docs.gofiber.io/middleware#websocket)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
app.Get("/ws", websocket.New(func(c *websocket.Conn) {
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
log.Printf("recv: %s", msg)
err = c.WriteMessage(mt, msg)
if err != nil {
log.Println("write:", err)
break
}
}
}))
app.Listen(3000)
// ws://localhost:3000/ws
}
```
### Recover middleware
📖 [Recover](https://docs.gofiber.io/middleware#recover)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/recover"
)
func main() {
app := fiber.New()
// Optional recover config
config := recover.Config{
Handler: func(c *fiber.Ctx, err error) {
c.SendString(err.Error())
c.SendStatus(500)
},
}
// Logger with custom config
app.Use(recover.New(config))
app.Listen(3000)
}
```
</details>
## 🧬 Official Middlewares
For an more _maintainable_ middleware _ecosystem_, we've put official [middlewares](https://docs.gofiber.io/middleware) into separate repositories:
- [gofiber/compression](https://github.com/gofiber/compression)
- [gofiber/basicauth](https://github.com/gofiber/basicauth)
- [gofiber/requestid](https://github.com/gofiber/requestid)
- [gofiber/websocket](https://github.com/gofiber/websocket)
- [gofiber/keyauth](https://github.com/gofiber/keyauth)
- [gofiber/rewrite](https://github.com/gofiber/rewrite)
- [gofiber/recover](https://github.com/gofiber/recover)
- [gofiber/limiter](https://github.com/gofiber/limiter)
- [gofiber/session](https://github.com/gofiber/session)
- [gofiber/adaptor](https://github.com/gofiber/adaptor)
- [gofiber/logger](https://github.com/gofiber/logger)
- [gofiber/helmet](https://github.com/gofiber/helmet)
- [gofiber/embed](https://github.com/gofiber/embed)
- [gofiber/pprof](https://github.com/gofiber/pprof)
- [gofiber/cors](https://github.com/gofiber/cors)
- [gofiber/csrf](https://github.com/gofiber/csrf)
- [gofiber/jwt](https://github.com/gofiber/jwt)
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
## 💬 Medien
- [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) — _03 Feb 2020_
- [Fiber released v1.7! 🎉 What's new and is it 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) — _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) — _03 Mar 2020_
- [Is switching from Express to Fiber worth it? 🤔](https://dev.to/koddr/are-sure-what-your-lovely-web-framework-running-so-fast-2jl1) — _01 Apr 2020_
- [Creating Fast APIs In Go Using Fiber](https://dev.to/jozsefsallai/creating-fast-apis-in-go-using-fiber-59m9) — _07 Apr 2020_
- [Building a Basic REST API in Go using Fiber](https://tutorialedge.net/golang/basic-rest-api-go-fiber/) - _23 Apr 2020_
- [📺 Building a REST API using GORM and Fiber](https://youtu.be/Iq2qT0fRhAA) - _25 Apr 2020_
- [🌎 Create a travel list app with Go, Fiber, Angular, MongoDB and Google Cloud Secret Manager](https://blog.yongweilun.me/create-a-travel-list-app-with-go-fiber-angular-mongodb-and-google-cloud-secret-manager-ck9fgxy0p061pcss1xt1ubu8t) - _25 Apr 2020_
- [Fiber v1.9.6 🔥 How to improve performance by 817% and stay fast, flexible and friendly?](https://dev.to/koddr/fiber-v1-9-5-how-to-improve-performance-by-817-and-stay-fast-flexible-and-friendly-2dp6) - _12 May 2020_
## 👍 Mitwirken
Falls du **danke** sagen möchtest und/oder aktiv die Entwicklung von `fiber` fördern möchtest:
1. Füge dem Projekt einen [GitHub Stern](https://github.com/gofiber/fiber/stargazers) hinzu.
2. Twittere über das Projekt [auf deinem Twitter](https://twitter.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
3. Schreibe eine Rezension auf [Medium](https://medium.com/), [Dev.to](https://dev.to/) oder einem persönlichem Blog.
4. Help us to translate our API Documentation via [Crowdin](https://crowdin.com/project/gofiber) [![Crowdin](https://badges.crowdin.net/gofiber/localized.svg)](https://crowdin.com/project/gofiber)
5. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).
## ☕ Supporters
Fiber is an open source project that runs on donations to pay the bills e.g. our domain name, gitbook, netlify and serverless hosting. If you want to support Fiber, you can ☕ [**buy a coffee here**](https://buymeacoff.ee/fenny).
| | User | Donation |
| :---------------------------------------------------------- | :---------------------------------------------- | :------- |
| ![](https://avatars.githubusercontent.com/u/59947262?s=25 ) | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/1094221?s=25 ) | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/186637?s=25 ) | [@candidosales](https://github.com/candidosales)| ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/635852?s=25 ) | [@bihe](https://github.com/bihe) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/307334?s=25 ) | [@justdave](https://github.com/justdave) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/11155743?s=25 ) | [@koddr](https://github.com/koddr) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/29042462?s=25 ) | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/2978730?s=25 ) | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/44171355?s=25 ) | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/5638101?s=25 ) | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/619996?s=25 ) | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31022056?s=25 ) | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31921460?s=25 ) | [@toishy](https://github.com/toishy) | ☕ x 1 |
## ‎‍💻 Code Contributors
<img src="https://opencollective.com/fiber/contributors.svg?width=890&button=false" alt="Code Contributors" style="max-width:100%;">
## ⚠️ License
Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) license (CC BY-SA 4.0 International).
**Third-party MIT licenses**
- [FastHTTP](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [Schema](https://github.com/gorilla/schema/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)

552
.github/README_es.md vendored Normal file
View File

@ -0,0 +1,552 @@
<p align="center">
<a href="https://gofiber.io">
<img alt="Fiber" height="125" src="https://github.com/gofiber/docs/blob/master/static/fiber_v2_logo.svg">
</a>
<br>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/en.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ru.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ru.svg">
</a>
<!--<a href="https://github.com/gofiber/fiber/blob/master/.github/README_es.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/es.svg">
</a>-->
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ja.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/jp.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_pt.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/pt.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_zh-CN.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ch.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_fr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/fr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_tr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/tr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_id.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/id.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_he.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/il.svg">
</a>
<br><br>
<a href="https://github.com/gofiber/fiber/releases">
<img src="https://img.shields.io/github/release/gofiber/fiber?style=flat-square">
</a>
<a href="https://docs.gofiber.io">
<img src="https://img.shields.io/badge/api-docs-blue?style=flat-square">
</a>
<a href="https://pkg.go.dev/github.com/gofiber/fiber?tab=doc">
<img src="https://img.shields.io/badge/go.dev-007d9c?logo=go&logoColor=white&style=flat-square">
</a>
<a href="https://goreportcard.com/report/github.com/gofiber/fiber">
<img src="https://goreportcard.com/badge/github.com/gofiber/fiber?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ATest">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Test?label=tests&style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3AGosec">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Gosec?label=gosec&style=flat-square">
</a>
<a href="https://gofiber.io/discord">
<img src="https://img.shields.io/badge/discord-join%20channel-7289DA?style=flat-square">
</a>
</p>
<p align="center">
<strong>Fiber</strong> es un <strong>framework web</strong> inspirado en <a href="https://github.com/expressjs/express">Express</a> construido sobre <a href="https://github.com/valyala/fasthttp">Fasthttp</a>, el motor HTTP <strong>más rápido</strong> para <a href="https://golang.org/doc/">Go</a>. Diseñado para <strong>facilitar</strong> las cosas para <strong>un</strong> desarrollo <strong>rápido</strong> con <strong>cero asignación de memoria</strong> y <strong>rendimiento</strong> en mente.
</p>
## ⚡️ Inicio rápido
```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)
}
```
## ⚙️ Instalación
En primer lugar, [descargue](https://golang.org/dl/) e instale Go. Se requiere `1.11` o superior.
La instalación se realiza con el comando [`go get`](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) :
```bash
go get github.com/gofiber/fiber/...
```
## 🤖 Puntos de referencia
Estas pruebas son realizadas por [TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks) y [Go Web](https://github.com/smallnest/go-web-framework-benchmark) . Si desea ver todos los resultados, visite nuestro [Wiki](https://docs.gofiber.io/benchmarks) .
<p float="left" align="middle">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark-pipeline.png" width="49%">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark_alloc.png" width="49%">
</p>
## 🎯 Características
- [Enrutamiento](https://docs.gofiber.io/routing) robusto
- Servir [archivos estáticos](https://docs.gofiber.io/application#static)
- [Rendimiento](https://docs.gofiber.io/benchmarks) extremo
- [Poca](https://docs.gofiber.io/benchmarks) huella de [memoria](https://docs.gofiber.io/benchmarks)
- [Puntos finales de API](https://docs.gofiber.io/context) Express
- Middleware y [próximo](https://docs.gofiber.io/context#next) soporte
- Programación [rápida](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) del lado del servidor
- [Template engines](https://docs.gofiber.io/middleware#template)
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
- Disponible en [12 idiomas](https://docs.gofiber.io/)
- Y mucho más, [explora Fiber](https://docs.gofiber.io/)
## 💡 Filosofía
Los nuevos gophers que hacen el cambio de [Node.js](https://nodejs.org/en/about/) a [Go](https://golang.org/doc/) están lidiando con una curva de aprendizaje antes de que puedan comenzar a construir sus aplicaciones web o microservicios. Fiber, como un **marco web** , fue creado con la idea del **minimalismo** y sigue el **camino de UNIX** , para que los nuevos gophers puedan ingresar rápidamente al mundo de Go con una cálida y confiable bienvenida.
Fiber está **inspirado** en Expressjs, el framework web más popular en Internet. Combinamos la **facilidad** de Express y **el rendimiento bruto** de Go. Si alguna vez ha implementado una aplicación web en Node.js ( *utilizando Express.js o similar* ), muchos métodos y principios le parecerán **muy comunes** .
## 👀 Ejemplos
A continuación se enumeran algunos de los ejemplos comunes. Si desea ver más ejemplos de código, visite nuestro [repositorio de Recetas](https://github.com/gofiber/recipes) o nuestra [documentación de API](https://docs.gofiber.io) .
### Routing
📖 [Routing](https://docs.gofiber.io/#basic-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
📖 [Static](https://docs.gofiber.io/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
📖 [Middleware](https://docs.gofiber.io/routing#middleware)
📖 [Next](https://docs.gofiber.io/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()
})
// GET /api/register
app.Get("/api/list", func(c *fiber.Ctx) {
fmt.Println("Last middleware")
c.Send("Hello, World!")
})
app.Listen(3000)
}
```
<details>
<summary>📚 Mostrar más ejemplos de código</summary>
### Template engines
📖 [Settings](https://docs.gofiber.io/application#settings)
📖 [Render](https://docs.gofiber.io/context#render)
📖 [Template](https://docs.gofiber.io/middleware#template)
Fiber soporta el [Go template engine](https://golang.org/pkg/html/template/) por default.
Pero si deseas usar otro template engine como [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) o [pug](https://github.com/Joker/jade).
Puedes usar nuestro [Template Middleware](https://docs.gofiber.io/middleware#template).
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/template"
)
func main() {
// You can setup template engine before initiation app:
app := fiber.New(&fiber.Settings{
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})
// OR after initiation app at any convenient location:
app.Settings.TemplateEngine = template.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,
})
})
// ...
}
```
### Agrupando rutas en cadenas
📖 [Group](https://docs.gofiber.io/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
📖 [Logger](https://docs.gofiber.io/middleware#logger)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/logger"
)
func main() {
app := fiber.New()
// Optional logger config
config := logger.Config{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Logger with config
app.Use(logger.New(config))
app.Listen(3000)
}
```
### Cross-Origin Resource Sharing (CORS)
📖 [CORS](https://docs.gofiber.io/middleware#cors)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/cors"
)
func main() {
app := fiber.New()
// CORS with default config
app.Use(cors.New())
app.Listen(3000)
}
```
Check CORS by passing any domain in `Origin` header:
```bash
curl -H "Origin: http://example.com" --verbose http://localhost:3000
```
### Respuesta 404 personalizada
📖 [HTTP Methods](https://docs.gofiber.io/application#http-methods)
```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)
}
```
### Respuesta JSON
📖 [JSON](https://docs.gofiber.io/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 Upgrade
📖 [Websocket](https://docs.gofiber.io/middleware#websocket)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
app.Get("/ws", websocket.New(func(c *websocket.Conn) {
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
log.Printf("recv: %s", msg)
err = c.WriteMessage(mt, msg)
if err != nil {
log.Println("write:", err)
break
}
}
}))
app.Listen(3000)
// ws://localhost:3000/ws
}
```
### Recover middleware
📖 [Recover](https://docs.gofiber.io/middleware#recover)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/recover"
)
func main() {
app := fiber.New()
// Optional recover config
config := recover.Config{
Handler: func(c *fiber.Ctx, err error) {
c.SendString(err.Error())
c.SendStatus(500)
},
}
// Logger with custom config
app.Use(recover.New(config))
app.Listen(3000)
}
```
</details>
## 🧬 Official Middlewares
For an more _maintainable_ middleware _ecosystem_, we've put official [middlewares](https://docs.gofiber.io/middleware) into separate repositories:
- [gofiber/compression](https://github.com/gofiber/compression)
- [gofiber/basicauth](https://github.com/gofiber/basicauth)
- [gofiber/requestid](https://github.com/gofiber/requestid)
- [gofiber/websocket](https://github.com/gofiber/websocket)
- [gofiber/keyauth](https://github.com/gofiber/keyauth)
- [gofiber/rewrite](https://github.com/gofiber/rewrite)
- [gofiber/recover](https://github.com/gofiber/recover)
- [gofiber/limiter](https://github.com/gofiber/limiter)
- [gofiber/session](https://github.com/gofiber/session)
- [gofiber/adaptor](https://github.com/gofiber/adaptor)
- [gofiber/logger](https://github.com/gofiber/logger)
- [gofiber/helmet](https://github.com/gofiber/helmet)
- [gofiber/embed](https://github.com/gofiber/embed)
- [gofiber/pprof](https://github.com/gofiber/pprof)
- [gofiber/cors](https://github.com/gofiber/cors)
- [gofiber/csrf](https://github.com/gofiber/csrf)
- [gofiber/jwt](https://github.com/gofiber/jwt)
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
## 💬 Medios
- [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) — _03 Feb 2020_
- [Fiber released v1.7! 🎉 What's new and is it 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) — _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) — _03 Mar 2020_
- [Is switching from Express to Fiber worth it? 🤔](https://dev.to/koddr/are-sure-what-your-lovely-web-framework-running-so-fast-2jl1) — _01 Apr 2020_
- [Creating Fast APIs In Go Using Fiber](https://dev.to/jozsefsallai/creating-fast-apis-in-go-using-fiber-59m9) — _07 Apr 2020_
- [Building a Basic REST API in Go using Fiber](https://tutorialedge.net/golang/basic-rest-api-go-fiber/) - _23 Apr 2020_
- [📺 Building a REST API using GORM and Fiber](https://youtu.be/Iq2qT0fRhAA) - _25 Apr 2020_
- [🌎 Create a travel list app with Go, Fiber, Angular, MongoDB and Google Cloud Secret Manager](https://blog.yongweilun.me/create-a-travel-list-app-with-go-fiber-angular-mongodb-and-google-cloud-secret-manager-ck9fgxy0p061pcss1xt1ubu8t) - _25 Apr 2020_
- [Fiber v1.9.6 🔥 How to improve performance by 817% and stay fast, flexible and friendly?](https://dev.to/koddr/fiber-v1-9-5-how-to-improve-performance-by-817-and-stay-fast-flexible-and-friendly-2dp6) - _12 May 2020_
## 👍 Contribuir
Si quiere **agradecer** y/o apoyar el desarrollo activo de `Fiber`:
1. Agrega una [estrella de GitHub](https://github.com/gofiber/fiber/stargazers) al proyecto.
2. Tuitea sobre el proyecto [en tu Twitter](https://twitter.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
3. Escribe una reseña o tutorial en [Medium](https://medium.com/) , [Dev.to](https://dev.to/) o blog personal.
4. Ayúdanos a traducir la documentación de nuestra API a través de [Crowdin](https://crowdin.com/project/gofiber) [![Crowdin](https://badges.crowdin.net/gofiber/localized.svg)](https://crowdin.com/project/gofiber)
5. Apoya el proyecto donando una [tasa de café](https://buymeacoff.ee/fenny).
## ☕ Personas que han mostrado su apoyo
Fiber es un proyecto open source que se mantiene a través de donaciones para pagar las cuentas e.g. nuestro nombre de dominio, gitbook, netlify y hosting serverless. Si quieres apoyar a Fiber, puedes ☕ [**comprar un café**](https://buymeacoff.ee/fenny).
| | User | Donation |
| :---------------------------------------------------------- | :---------------------------------------------- | :------- |
| ![](https://avatars.githubusercontent.com/u/59947262?s=25 ) | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/1094221?s=25 ) | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/186637?s=25 ) | [@candidosales](https://github.com/candidosales)| ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/635852?s=25 ) | [@bihe](https://github.com/bihe) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/307334?s=25 ) | [@justdave](https://github.com/justdave) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/11155743?s=25 ) | [@koddr](https://github.com/koddr) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/29042462?s=25 ) | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/2978730?s=25 ) | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/44171355?s=25 ) | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/5638101?s=25 ) | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/619996?s=25 ) | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31022056?s=25 ) | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31921460?s=25 ) | [@toishy](https://github.com/toishy) | ☕ x 1 |
## ‎‍💻 Contribuyentes de código
<img src="https://opencollective.com/fiber/contributors.svg?width=890&button=false" alt="Code Contributors" style="max-width:100%;">
## ⚠️ Licencia
Copyright (c) 2019-presente [Fenny](https://github.com/fenny) y [contribuyentes](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` es software libre y de código abierto bajo la licencia [MIT](https://github.com/gofiber/fiber/blob/master/LICENSE). El logo oficial fué creado por [Vic Shóstak](https://github.com/koddr) y distribuido bajo la licencia [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) (CC BY-SA 4.0 International).
**Third-party library licenses**
- [FastHTTP](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [Schema](https://github.com/gorilla/schema/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)

552
.github/README_fr.md vendored Normal file
View File

@ -0,0 +1,552 @@
<p align="center">
<a href="https://gofiber.io">
<img alt="Fiber" height="125" src="https://github.com/gofiber/docs/blob/master/static/fiber_v2_logo.svg">
</a>
<br>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/en.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ru.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ru.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_es.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/es.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ja.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/jp.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_pt.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/pt.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_zh-CN.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ch.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>
<!--<a href="https://github.com/gofiber/fiber/blob/master/.github/README_fr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/fr.svg">
</a>-->
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_tr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/tr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_id.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/id.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_he.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/il.svg">
</a>
<br><br>
<a href="https://github.com/gofiber/fiber/releases">
<img src="https://img.shields.io/github/release/gofiber/fiber?style=flat-square">
</a>
<a href="https://docs.gofiber.io">
<img src="https://img.shields.io/badge/api-docs-blue?style=flat-square">
</a>
<a href="https://pkg.go.dev/github.com/gofiber/fiber?tab=doc">
<img src="https://img.shields.io/badge/go.dev-007d9c?logo=go&logoColor=white&style=flat-square">
</a>
<a href="https://goreportcard.com/report/github.com/gofiber/fiber">
<img src="https://goreportcard.com/badge/github.com/gofiber/fiber?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ATest">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Test?label=tests&style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3AGosec">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Gosec?label=gosec&style=flat-square">
</a>
<a href="https://gofiber.io/discord">
<img src="https://img.shields.io/badge/discord-join%20channel-7289DA?style=flat-square">
</a>
</p>
<p align="center">
<b>Fiber</b> est un framework web inspiré d' <a href="https://github.com/expressjs/express">Express</a>. Il se base sur <a href="https://github.com/valyala/fasthttp">Fasthttp</a>, l'implémentation HTTP de <a href="https://golang.org/doc/">Go</a> <b>la plus rapide</b>. Conçu pour <b>faciliter</b> les choses pour des développements <b>rapides</b>, Fiber garde à l'esprit <b>l'absence d'allocations mémoires</b>, ainsi que les <b>performances</b>.
</p>
## ⚡️ 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
Premièrement, [téléchargez](https://golang.org/dl/) et installez Go. Version `1.11` ou supérieur requise.
L'installation est ensuite lancée via la commande [`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
Ces tests sont effectués par [TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks) et [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Si vous voulez voir tous les résultats, n'hésitez pas à consulter notre [Wiki](https://docs.gofiber.io/benchmarks).
<p float="left" align="middle">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark-pipeline.png" width="49%">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark_alloc.png" width="49%">
</p>
## 🎯 Features
- [Routing](https://docs.gofiber.io/routing) robuste
- Serve [static files](https://docs.gofiber.io/application#static)
- [Performances](https://docs.gofiber.io/benchmarks) extrêmes
- [Faible empreinte mémoire](https://docs.gofiber.io/benchmarks)
- [API endpoints](https://docs.gofiber.io/context)
- Middleware & [Next](https://docs.gofiber.io/context#next) support
- Programmation côté serveur [rapide](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497)
- [Template engines](https://docs.gofiber.io/middleware#template)
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
- Available in [12 languages](https://docs.gofiber.io/)
- Et plus encore, [explorez Fiber](https://docs.gofiber.io/)
## 💡 Philosophie
Les nouveaux gophers qui passent de [Node.js](https://nodejs.org/en/about/) à [Go](https://golang.org/doc/) sont confrontés à une courbe d'apprentissage, avant de pouvoir construire leurs applications web et microservices. Fiber, en tant que **framework web**, a été mis au point avec en tête l'idée de **minimalisme**, tout en suivant l'**UNIX way**, afin que les nouveaux gophers puissent rapidement entrer dans le monde de Go, avec un accueil chaleureux, de confiance.
Fiber est **inspiré** par Express, le framework web le plus populaire d'Internet. Nous avons combiné la **facilité** d'Express, et la **performance brute** de Go. Si vous avez déja développé une application web en Node.js (_en utilisant Express ou équivalent_), alors de nombreuses méthodes et principes vous sembleront **familiers**.
## 👀 Exemples
Ci-dessous quelques exemples courants. Si vous voulez voir plus d'exemples, rendez-vous sur notre ["Recipes repository"](https://github.com/gofiber/recipes) ou visitez notre [documentation API](https://docs.gofiber.io).
### Routing
📖 [Routing](https://docs.gofiber.io/#basic-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
📖 [Static](https://docs.gofiber.io/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
📖 [Middleware](https://docs.gofiber.io/routing#middleware)
📖 [Next](https://docs.gofiber.io/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()
})
// GET /api/register
app.Get("/api/list", func(c *fiber.Ctx) {
fmt.Println("Last middleware")
c.Send("Hello, World!")
})
app.Listen(3000)
}
```
<details>
<summary>📚 Show more code examples</summary>
### Template engines
📖 [Settings](https://docs.gofiber.io/application#settings)
📖 [Render](https://docs.gofiber.io/context#render)
📖 [Template](https://docs.gofiber.io/middleware#template)
Fiber supports the default [Go template engine](https://golang.org/pkg/html/template/)
But if you want to use another template engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade).
You can use our [Template Middleware](https://docs.gofiber.io/middleware#template).
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/template"
)
func main() {
// You can setup template engine before initiation app:
app := fiber.New(&fiber.Settings{
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})
// OR after initiation app at any convenient location:
app.Settings.TemplateEngine = template.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
📖 [Group](https://docs.gofiber.io/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
📖 [Logger](https://docs.gofiber.io/middleware#logger)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/logger"
)
func main() {
app := fiber.New()
// Optional logger config
config := logger.Config{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Logger with config
app.Use(logger.New(config))
app.Listen(3000)
}
```
### Cross-Origin Resource Sharing (CORS)
📖 [CORS](https://docs.gofiber.io/middleware#cors)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/cors"
)
func main() {
app := fiber.New()
// CORS with default config
app.Use(cors.New())
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
📖 [HTTP Methods](https://docs.gofiber.io/application#http-methods)
```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
📖 [JSON](https://docs.gofiber.io/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 Upgrade
📖 [Websocket](https://docs.gofiber.io/middleware#websocket)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
app.Get("/ws", websocket.New(func(c *websocket.Conn) {
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
log.Printf("recv: %s", msg)
err = c.WriteMessage(mt, msg)
if err != nil {
log.Println("write:", err)
break
}
}
}))
app.Listen(3000)
// ws://localhost:3000/ws
}
```
### Recover middleware
📖 [Recover](https://docs.gofiber.io/middleware#recover)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/recover"
)
func main() {
app := fiber.New()
// Optional recover config
config := recover.Config{
Handler: func(c *fiber.Ctx, err error) {
c.SendString(err.Error())
c.SendStatus(500)
},
}
// Logger with custom config
app.Use(recover.New(config))
app.Listen(3000)
}
```
</details>
## 🧬 Official Middlewares
For an more _maintainable_ middleware _ecosystem_, we've put official [middlewares](https://docs.gofiber.io/middleware) into separate repositories:
- [gofiber/compression](https://github.com/gofiber/compression)
- [gofiber/basicauth](https://github.com/gofiber/basicauth)
- [gofiber/requestid](https://github.com/gofiber/requestid)
- [gofiber/websocket](https://github.com/gofiber/websocket)
- [gofiber/keyauth](https://github.com/gofiber/keyauth)
- [gofiber/rewrite](https://github.com/gofiber/rewrite)
- [gofiber/recover](https://github.com/gofiber/recover)
- [gofiber/limiter](https://github.com/gofiber/limiter)
- [gofiber/session](https://github.com/gofiber/session)
- [gofiber/adaptor](https://github.com/gofiber/adaptor)
- [gofiber/logger](https://github.com/gofiber/logger)
- [gofiber/helmet](https://github.com/gofiber/helmet)
- [gofiber/embed](https://github.com/gofiber/embed)
- [gofiber/pprof](https://github.com/gofiber/pprof)
- [gofiber/cors](https://github.com/gofiber/cors)
- [gofiber/csrf](https://github.com/gofiber/csrf)
- [gofiber/jwt](https://github.com/gofiber/jwt)
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
## 💬 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) — _03 Feb 2020_
- [Fiber released v1.7! 🎉 What's new and is it 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) — _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) — _03 Mar 2020_
- [Is switching from Express to Fiber worth it? 🤔](https://dev.to/koddr/are-sure-what-your-lovely-web-framework-running-so-fast-2jl1) — _01 Apr 2020_
- [Creating Fast APIs In Go Using Fiber](https://dev.to/jozsefsallai/creating-fast-apis-in-go-using-fiber-59m9) — _07 Apr 2020_
- [Building a Basic REST API in Go using Fiber](https://tutorialedge.net/golang/basic-rest-api-go-fiber/) - _23 Apr 2020_
- [📺 Building a REST API using GORM and Fiber](https://youtu.be/Iq2qT0fRhAA) - _25 Apr 2020_
- [🌎 Create a travel list app with Go, Fiber, Angular, MongoDB and Google Cloud Secret Manager](https://blog.yongweilun.me/create-a-travel-list-app-with-go-fiber-angular-mongodb-and-google-cloud-secret-manager-ck9fgxy0p061pcss1xt1ubu8t) - _25 Apr 2020_
- [Fiber v1.9.6 🔥 How to improve performance by 817% and stay fast, flexible and friendly?](https://dev.to/koddr/fiber-v1-9-5-how-to-improve-performance-by-817-and-stay-fast-flexible-and-friendly-2dp6) - _12 May 2020_
## 👍 Contribuer
Si vous voulez nous remercier et/ou soutenir le développement actif de `Fiber`:
1. Ajoutez une [GitHub Star](https://github.com/gofiber/fiber/stargazers) à ce projet.
2. Twittez à propos de ce projet [sur votre Twitter](https://twitter.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
3. Ecrivez un article (review, tutorial) sur [Medium](https://medium.com/), [Dev.to](https://dev.to/), ou encore un blog personnel.
4. Help us to translate our API Documentation via [Crowdin](https://crowdin.com/project/gofiber) [![Crowdin](https://badges.crowdin.net/gofiber/localized.svg)](https://crowdin.com/project/gofiber)
5. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).
## ☕ Supporters
Fiber is an open source project that runs on donations to pay the bills e.g. our domain name, gitbook, netlify and serverless hosting. If you want to support Fiber, you can ☕ [**buy a coffee here**](https://buymeacoff.ee/fenny).
| | User | Donation |
| :---------------------------------------------------------- | :---------------------------------------------- | :------- |
| ![](https://avatars.githubusercontent.com/u/59947262?s=25 ) | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/1094221?s=25 ) | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/186637?s=25 ) | [@candidosales](https://github.com/candidosales)| ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/635852?s=25 ) | [@bihe](https://github.com/bihe) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/307334?s=25 ) | [@justdave](https://github.com/justdave) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/11155743?s=25 ) | [@koddr](https://github.com/koddr) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/29042462?s=25 ) | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/2978730?s=25 ) | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/44171355?s=25 ) | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/5638101?s=25 ) | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/619996?s=25 ) | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31022056?s=25 ) | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31921460?s=25 ) | [@toishy](https://github.com/toishy) | ☕ x 1 |
## ‎‍💻 Code Contributors
<img src="https://opencollective.com/fiber/contributors.svg?width=890&button=false" alt="Code Contributors" style="max-width:100%;">
## ⚠️ License
Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) license (CC BY-SA 4.0 International).
**Third-party library licenses**
- [FastHTTP](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [Schema](https://github.com/gorilla/schema/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)

712
.github/README_he.md vendored Normal file
View File

@ -0,0 +1,712 @@
<p align="center">
<a href="https://gofiber.io">
<img alt="Fiber" height="125" src="https://github.com/gofiber/docs/blob/master/static/fiber_v2_logo.svg">
</a>
<br>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/en.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ru.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ru.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_es.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/es.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ja.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/jp.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_pt.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/pt.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_zh-CN.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ch.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_fr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/fr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_tr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/tr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_id.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/id.svg">
</a>
<!-- <a href="https://github.com/gofiber/fiber/blob/master/.github/README_he.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/il.svg">
</a> -->
<br><br>
<div dir="rtl">
<a href="https://github.com/gofiber/fiber/releases">
<img src="https://img.shields.io/github/release/gofiber/fiber?style=flat-square">
</a>
<a href="https://docs.gofiber.io">
<img src="https://img.shields.io/badge/api-docs-blue?style=flat-square">
</a>
<a href="https://pkg.go.dev/github.com/gofiber/fiber?tab=doc">
<img src="https://img.shields.io/badge/go.dev-007d9c?logo=go&logoColor=white&style=flat-square">
</a>
<a href="https://goreportcard.com/report/github.com/gofiber/fiber">
<img src="https://goreportcard.com/badge/github.com/gofiber/fiber?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ATest">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Test?label=tests&style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3AGosec">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Gosec?label=gosec&style=flat-square">
</a>
<a href="https://gofiber.io/discord">
<img src="https://img.shields.io/badge/discord-join%20channel-7289DA?style=flat-square">
</a>
</div>
</p>
<p align="center">
<div dir="rtl">
<b>Fiber</b> היא <b>web framework</b> בהשראת <a href="https://github.com/expressjs/express">Express</a> הבנויה על גבי <a href="https://github.com/valyala/fasthttp">Fasthttp</a>, מנוע ה-HTTP <b>המהיר ביותר</b> עבור <a href="https://golang.org/doc/">Go</a>.
נועדה <b>להקל</b> על העניינים למען פיתוח <b>מהיר</b>, <b>ללא הקצאות זכרון</b> ולוקחת <b>ביצועים</b> בחשבון.
</div>
</p>
<div dir="rtl">
## ⚡️ התחלה מהירה
</div>
```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)
}
```
<div dir="rtl">
## ⚙️ התקנה
</div>
<div dir="rtl">
קודם כל, [הורידו](https://golang.org/dl/) והתקינו את Go. נדרשת גרסה <span dir="ltr">`1.11`</span> ומעלה.
</div>
<div dir="rtl">
ההתקנה מתבצעת באמצעות הפקודה <span dir="ltr">[`go get`](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them)</span>:
</div>
```bash
go get -u github.com/gofiber/fiber
```
<div dir="rtl">
## 🤖 מדדים
</div>
<div dir="rtl">
הבדיקות מבוצעות על ידי [TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks) ו-[Go Web](https://github.com/smallnest/go-web-framework-benchmark). אם אתם רוצים לראות את כל התוצאות, אנא בקרו ב-[Wiki](https://docs.gofiber.io/benchmarks) שלנו.
</div>
<p float="left" align="middle">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark-pipeline.png" width="49%">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark_alloc.png" width="49%">
</p>
<div dir="rtl">
## 🎯 יכולות
</div>
<div dir="rtl">
- [ניתוב](https://docs.gofiber.io/routing) רובסטי
- הנגשת [קבצים סטטיים](https://docs.gofiber.io/application#static)
- [ביצועים](https://docs.gofiber.io/benchmarks) גבוהים במיוחד
- צורך כמות [זכרון קטנה](https://docs.gofiber.io/benchmarks)
- [נקודות קצה עבור API](https://docs.gofiber.io/context)
- תמיכה ב-[Middleware](https://docs.gofiber.io/middleware) & [Next](https://docs.gofiber.io/context#next)
- תכנות [מהיר](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) של צד שרת
- [מנועי תבניות](https://docs.gofiber.io/middleware#template)
- [תמיכה ב-WebSocket](https://docs.gofiber.io/middleware#websocket)
- [הגבלת קצבים ובקשות](https://docs.gofiber.io/middleware#limiter)
- תורגם ל-12 שפות אחרות
- והרבה יותר, [חקור את Fiber](https://docs.gofiber.io/)
</div>
<div dir="rtl">
## 💡 פילוסופיה
</div>
<div dir="rtl">
gophers חדשים שעושים את המעבר מ-[Node.js](https://nodejs.org/en/about/) ל-[Go](https://golang.org/doc/) מתמודדים עם עקומת למידה לפני שהם יכולים להתחיל לבנות את יישומי האינטרנט או המיקרו-שירותים שלהם.
Fiber כ-**web framework**, נוצרה עם רעיון **המינימליזם** ועוקבת אחרי **הדרך של UNIX**, כך ש-gophers חדשים יוכלו להיכנס במהירות לעולם של Go עם קבלת פנים חמה ואמינה.
</div>
<div dir="rtl">
Fiber נוצרה **בהשראת** Express, ה-web framework הפופולרית ביותר ברחבי האינטרנט. שילבנו את **הקלות** של Express ו**הביצועים הגולמיים** של Go. אם אי-פעם מימשתם יישום web ב-Node.js (_באמצעות Express או דומיו_), אז הרבה מהפונקציות והעקרונות ייראו לכם **מאוד מוכרים**.
</div>
<div dir="rtl">
אנחנו **מקשיבים** למשתמשים שלנו ב-[issues](https://github.com/gofiber/fiber/issues) (_ובכל רחבי האינטרנט_) כדי ליצור web framework **מהירה**, **גמישה**, ו**ידידותית** בשפת Go עבור **כל** משימה, **תאריך יעד** ו**כישורי** מפתח! בדיוק כמו ש-Express מבצע בעולם של JavaScript.
</div>
<div dir="rtl">
## 👀 דוגמאות
</div>
<div dir="rtl">
להלן כמה מהדוגמאות הנפוצות.
</div>
<div dir="rtl">
> אם ברצונכם לראות דוגמאות קוד נוספות, אנא בקרו ב[מאגר המתכונים](https://github.com/gofiber/recipes) שלנו או בקרו ב[תיעוד ה-API](https://docs.gofiber.io) שלנו.
</div>
<div dir="rtl">
### ניתוב
</div>
<div dir="rtl">
📖 [ניתוב](https://docs.gofiber.io/#basic-routing)
</div>
```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)
}
```
<div dir="rtl">
### הנגשת קבצים סטטיים
</div>
<div dir="rtl">
📖 [קבצים סטטיים](https://docs.gofiber.io/application#static)
</div>
```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)
}
```
<div dir="rtl">
### Middleware & Next
</div>
<div dir="rtl">
📖 [Middleware](https://docs.gofiber.io/routing#middleware)
📖 [Next](https://docs.gofiber.io/context#next)
</div>
```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()
})
// GET /api/register
app.Get("/api/list", func(c *fiber.Ctx) {
fmt.Println("Last middleware")
c.Send("Hello, World!")
})
app.Listen(3000)
}
```
<div dir="rtl">
<details>
<summary>📚 הצג דוגמאות קוד נוספות</summary>
### מנועי תבניות
📖 [הגדרות](https://docs.gofiber.io/application#settings)
📖 [רנדור](https://docs.gofiber.io/context#render)
📖 [תבניות](https://docs.gofiber.io/middleware#template)
Fiber תומך כברירת מחדל ב[מנוע התבניות של Go](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).
אתם יכולים להשתמש ב[Middleware של התבניות](https://docs.gofiber.io/middleware#template) שלנו.
<div dir="ltr">
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/template"
)
func main() {
// You can setup template engine before initiation app:
app := fiber.New(&fiber.Settings{
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})
// OR after initiation app at any convenient location:
app.Settings.TemplateEngine = template.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,
})
})
// ...
}
```
</div>
### קיבוץ routes ל-chains
📖 [קבוצות](https://docs.gofiber.io/application#group)
<div dir="ltr">
```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
// ...
}
```
</div>
### Middleware של לוגים
📖 [Logger](https://docs.gofiber.io/middleware#logger)
<div dir="ltr">
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/logger"
)
func main() {
app := fiber.New()
// Optional logger config
config := logger.Config{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Logger with config
app.Use(logger.New(config))
app.Listen(3000)
}
```
</div>
### שיתוף משאבים בין מקורות (CORS)
📖 [CORS](https://docs.gofiber.io/middleware#cors)
<div dir="ltr">
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/cors"
)
func main() {
app := fiber.New()
// CORS with default config
app.Use(cors.New())
app.Listen(3000)
}
```
</div>
בדוק את ה-CORS על ידי העברת כל domain ב-header של <span dir="ltr">`Origin`</span>:
<div dir="ltr">
```bash
curl -H "Origin: http://example.com" --verbose http://localhost:3000
```
</div>
### תגובת 404 מותאמת אישית
📖 [שיטות HTTP](https://docs.gofiber.io/application#http-methods)
<div dir="ltr">
```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)
}
```
</div>
### תגובת JSON
📖 [JSON](https://docs.gofiber.io/context#json)
<div dir="ltr">
```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)
}
```
</div>
### WebSocket Upgrade
📖 [Websocket](https://docs.gofiber.io/middleware#websocket)
<div dir="ltr">
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
app.Get("/ws", websocket.New(func(c *websocket.Conn) {
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
log.Printf("recv: %s", msg)
err = c.WriteMessage(mt, msg)
if err != nil {
log.Println("write:", err)
break
}
}
}))
app.Listen(3000)
// ws://localhost:3000/ws
}
```
</div>
### Middleware של התאוששות
📖 [התאוששות](https://docs.gofiber.io/middleware#recover)
<div dir="ltr">
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/recover"
)
func main() {
app := fiber.New()
// Optional recover config
config := recover.Config{
Handler: func(c *fiber.Ctx, err error) {
c.SendString(err.Error())
c.SendStatus(500)
},
}
// Logger with custom config
app.Use(recover.New(config))
app.Listen(3000)
}
```
</div>
</details>
</div>
<div dir="rtl">
## 🧬 Official Middlewares
</div>
<div dir="rtl">
For an more _maintainable_ middleware _ecosystem_, we've put official [middlewares](https://docs.gofiber.io/middleware) into separate repositories:
</div>
<div dir="rtl">
- [gofiber/compression](https://github.com/gofiber/compression)
- [gofiber/basicauth](https://github.com/gofiber/basicauth)
- [gofiber/requestid](https://github.com/gofiber/requestid)
- [gofiber/websocket](https://github.com/gofiber/websocket)
- [gofiber/keyauth](https://github.com/gofiber/keyauth)
- [gofiber/rewrite](https://github.com/gofiber/rewrite)
- [gofiber/recover](https://github.com/gofiber/recover)
- [gofiber/limiter](https://github.com/gofiber/limiter)
- [gofiber/session](https://github.com/gofiber/session)
- [gofiber/adaptor](https://github.com/gofiber/adaptor)
- [gofiber/logger](https://github.com/gofiber/logger)
- [gofiber/helmet](https://github.com/gofiber/helmet)
- [gofiber/embed](https://github.com/gofiber/embed)
- [gofiber/pprof](https://github.com/gofiber/pprof)
- [gofiber/cors](https://github.com/gofiber/cors)
- [gofiber/csrf](https://github.com/gofiber/csrf)
- [gofiber/jwt](https://github.com/gofiber/jwt)
</div>
<div dir="rtl">
## 🌱 Third Party Middlewares
</div>
<div dir="rtl">
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
</div>
<div dir="rtl">
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
</div>
<div dir="rtl">
## 💬 מדיה
</div>
<div dir="ltr">
- [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) — _03 Feb 2020_
- [Fiber released v1.7! 🎉 What's new and is it 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) — _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) — _03 Mar 2020_
- [Is switching from Express to Fiber worth it? 🤔](https://dev.to/koddr/are-sure-what-your-lovely-web-framework-running-so-fast-2jl1) — _01 Apr 2020_
- [Creating Fast APIs In Go Using Fiber](https://dev.to/jozsefsallai/creating-fast-apis-in-go-using-fiber-59m9) — _07 Apr 2020_
- [Building a Basic REST API in Go using Fiber](https://tutorialedge.net/golang/basic-rest-api-go-fiber/) - _23 Apr 2020_
- [📺 Building a REST API using GORM and Fiber](https://youtu.be/Iq2qT0fRhAA) - _25 Apr 2020_
- [🌎 Create a travel list app with Go, Fiber, Angular, MongoDB and Google Cloud Secret Manager](https://blog.yongweilun.me/create-a-travel-list-app-with-go-fiber-angular-mongodb-and-google-cloud-secret-manager-ck9fgxy0p061pcss1xt1ubu8t) - _25 Apr 2020_
- [Fiber v1.9.6 🔥 How to improve performance by 817% and stay fast, flexible and friendly?](https://dev.to/koddr/fiber-v1-9-5-how-to-improve-performance-by-817-and-stay-fast-flexible-and-friendly-2dp6) - _12 May 2020_
</div>
<div dir="rtl">
## 👍 לתרום
</div>
<div dir="rtl">
אם אתם רוצים לומר **תודה** או/ו לתמוך בפיתוח הפעיל של <span dir="ltr">`Fiber`</span>:
</div>
<div dir="rtl">
1. תוסיפו [GitHub Star](https://github.com/gofiber/fiber/stargazers) לפרויקט.
2. צייצו לגבי הפרויקט [בטוויטר שלכם](https://twitter.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
3. כתבו ביקורת או מדריך ב-[Medium](https://medium.com/), [Dev.to](https://dev.to/) או בבלוג האישי שלכם.
4. עזרו לנו לתרגם את ה-<span dir="ltr">`README`</span> הזה לשפה אחרת.
5. תמכו בפרויקט על ידי תרומת [כוס קפה](https://buymeacoff.ee/fenny).
</div>
<div dir="rtl">
## ☕ תומכים
</div>
<div dir="rtl">
Fiber היא פרויקט קוד פתוח שתשלום חשובונתיו מסתמך על תרומות, כגון שם ה-domain שלנו, gitbook, netlify ו-serverless hosting. אם אתם רוצים לתמוך ב-Fiber, אתם יכולים ☕ [**קנו קפה כאן**](https://buymeacoff.ee/fenny).
</div>
| | משתמש | תרומה |
| :---------------------------------------------------------- | :---------------------------------------------- | :---- |
| ![](https://avatars.githubusercontent.com/u/59947262?s=25 ) | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/1094221?s=25 ) | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/186637?s=25 ) | [@candidosales](https://github.com/candidosales)| ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/635852?s=25 ) | [@bihe](https://github.com/bihe) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/307334?s=25 ) | [@justdave](https://github.com/justdave) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/11155743?s=25 ) | [@koddr](https://github.com/koddr) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/29042462?s=25 ) | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/2978730?s=25 ) | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/44171355?s=25 ) | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/5638101?s=25 ) | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/619996?s=25 ) | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31022056?s=25 ) | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31921460?s=25 ) | [@toishy](https://github.com/toishy) | ☕ x 1 |
<div dir="rtl">
## ‎‍💻 תורמי קוד
</div>
<img src="https://opencollective.com/fiber/contributors.svg?width=890&button=false" alt="Code Contributors" style="max-width:100%;">
<div dir="rtl">
## ⚠️ רישיון
</div>
<div dir="ltr">
Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) license (CC BY-SA 4.0 International).
</div>
<div dir="rtl">
**רישיונות של ספריות צד שלישי**
- [FastHTTP](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [Schema](https://github.com/gorilla/schema/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)
</div>

554
.github/README_id.md vendored Normal file
View File

@ -0,0 +1,554 @@
<p align="center">
<a href="https://gofiber.io">
<img alt="Fiber" height="125" src="https://github.com/gofiber/docs/blob/master/static/fiber_v2_logo.svg">
</a>
<br>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/en.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ru.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ru.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_es.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/es.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ja.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/jp.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_pt.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/pt.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_zh-CN.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ch.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_fr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/fr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_tr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/tr.svg">
</a>
<!--<a href="https://github.com/gofiber/fiber/blob/master/.github/README_id.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/id.svg">
</a>-->
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_he.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/il.svg">
</a>
<br><br>
<a href="https://github.com/gofiber/fiber/releases">
<img src="https://img.shields.io/github/release/gofiber/fiber?style=flat-square">
</a>
<a href="https://docs.gofiber.io">
<img src="https://img.shields.io/badge/api-docs-blue?style=flat-square">
</a>
<a href="https://pkg.go.dev/github.com/gofiber/fiber?tab=doc">
<img src="https://img.shields.io/badge/go.dev-007d9c?logo=go&logoColor=white&style=flat-square">
</a>
<a href="https://goreportcard.com/report/github.com/gofiber/fiber">
<img src="https://goreportcard.com/badge/github.com/gofiber/fiber?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ATest">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Test?label=tests&style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3AGosec">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Gosec?label=gosec&style=flat-square">
</a>
<a href="https://gofiber.io/discord">
<img src="https://img.shields.io/badge/discord-join%20channel-7289DA?style=flat-square">
</a>
</p>
<p align="center">
<b>Fiber</b> adalah <b>web framework</b> yang terinspirasi dari <a href="https://github.com/expressjs/express">Express</a> yang berbasiskan <a href="https://github.com/valyala/fasthttp">Fasthttp</a>, HTTP engine paling <b>cepat</b> untuk <a href="https://golang.org/doc/">Go</a>. Dirancang untuk <b>mempermudah</b>, <b>mempercepat</b> pengembangan aplikasi dengan <b>alokasi memori nol-nya</b> serta <b>kinerja</b> yang selalu diperhatikan.
</p>
## ⚡️ Cara Mulai
```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)
}
```
## ⚙️ Instalasi
Pertama, [unduh](https://golang.org/dl/) dan instal Go di komputer anda. Versi `1.11` atau yang lebih tinggi diperlukan.
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/...
```
## 🤖 Pengukuran Kinerja
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://docs.gofiber.io/benchmarks) kami.
<p float="left" align="middle">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark-pipeline.png" width="49%">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark_alloc.png" width="49%">
</p>
## 🎯 Fitur
- Sistem [Routing](https://docs.gofiber.io/routing) yang solid
- Serve [file statis](https://docs.gofiber.io/application#static)
- [Kinerja](https://docs.gofiber.io/benchmarks) ekstrim
- [Penggunaan memori](https://docs.gofiber.io/benchmarks) yang kecil
- Cocok untuk [API](https://docs.gofiber.io/context)
- Mendukung Middleware & [Next](https://docs.gofiber.io/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)
- [Template engines](https://docs.gofiber.io/middleware#template)
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
- Available in [12 languages](https://docs.gofiber.io/)
- Dan masih banyak lagi, [kunjungi Fiber](https://docs.gofiber.io/)
## 💡 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 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.
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.
## 👀 Contoh
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://docs.gofiber.io) kami.
### Routing
📖 [Routing](https://docs.gofiber.io/#basic-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
📖 [Static](https://docs.gofiber.io/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
📖 [Middleware](https://docs.gofiber.io/routing#middleware)
📖 [Next](https://docs.gofiber.io/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()
})
// GET /api/register
app.Get("/api/list", func(c *fiber.Ctx) {
fmt.Println("Last middleware")
c.Send("Hello, World!")
})
app.Listen(3000)
}
```
<details>
<summary>📚 Show more code examples</summary>
### Template engines
📖 [Settings](https://docs.gofiber.io/application#settings)
📖 [Render](https://docs.gofiber.io/context#render)
📖 [Template](https://docs.gofiber.io/middleware#template)
Fiber supports the default [Go template engine](https://golang.org/pkg/html/template/)
But if you want to use another template engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade).
You can use our [Template Middleware](https://docs.gofiber.io/middleware#template).
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/template"
)
func main() {
// You can setup template engine before initiation app:
app := fiber.New(&fiber.Settings{
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})
// OR after initiation app at any convenient location:
app.Settings.TemplateEngine = template.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
📖 [Group](https://docs.gofiber.io/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
📖 [Logger](https://docs.gofiber.io/middleware#logger)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/logger"
)
func main() {
app := fiber.New()
// Optional logger config
config := logger.Config{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Logger with config
app.Use(logger.New(config))
app.Listen(3000)
}
```
### Cross-Origin Resource Sharing (CORS)
📖 [CORS](https://docs.gofiber.io/middleware#cors)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/cors"
)
func main() {
app := fiber.New()
// CORS with default config
app.Use(cors.New())
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
📖 [HTTP Methods](https://docs.gofiber.io/application#http-methods)
```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
📖 [JSON](https://docs.gofiber.io/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 Upgrade
📖 [Websocket](https://docs.gofiber.io/middleware#websocket)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
app.Get("/ws", websocket.New(func(c *websocket.Conn) {
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
log.Printf("recv: %s", msg)
err = c.WriteMessage(mt, msg)
if err != nil {
log.Println("write:", err)
break
}
}
}))
app.Listen(3000)
// ws://localhost:3000/ws
}
```
### Recover middleware
📖 [Recover](https://docs.gofiber.io/middleware#recover)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/recover"
)
func main() {
app := fiber.New()
// Optional recover config
config := recover.Config{
Handler: func(c *fiber.Ctx, err error) {
c.SendString(err.Error())
c.SendStatus(500)
},
}
// Logger with custom config
app.Use(recover.New(config))
app.Listen(3000)
}
```
</details>
## 🧬 Official Middlewares
For an more _maintainable_ middleware _ecosystem_, we've put official [middlewares](https://docs.gofiber.io/middleware) into separate repositories:
- [gofiber/compression](https://github.com/gofiber/compression)
- [gofiber/basicauth](https://github.com/gofiber/basicauth)
- [gofiber/requestid](https://github.com/gofiber/requestid)
- [gofiber/websocket](https://github.com/gofiber/websocket)
- [gofiber/keyauth](https://github.com/gofiber/keyauth)
- [gofiber/rewrite](https://github.com/gofiber/rewrite)
- [gofiber/recover](https://github.com/gofiber/recover)
- [gofiber/limiter](https://github.com/gofiber/limiter)
- [gofiber/session](https://github.com/gofiber/session)
- [gofiber/adaptor](https://github.com/gofiber/adaptor)
- [gofiber/logger](https://github.com/gofiber/logger)
- [gofiber/helmet](https://github.com/gofiber/helmet)
- [gofiber/embed](https://github.com/gofiber/embed)
- [gofiber/pprof](https://github.com/gofiber/pprof)
- [gofiber/cors](https://github.com/gofiber/cors)
- [gofiber/csrf](https://github.com/gofiber/csrf)
- [gofiber/jwt](https://github.com/gofiber/jwt)
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
## 💬 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) — _03 Feb 2020_
- [Fiber released v1.7! 🎉 What's new and is it 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) — _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) — _03 Mar 2020_
- [Is switching from Express to Fiber worth it? 🤔](https://dev.to/koddr/are-sure-what-your-lovely-web-framework-running-so-fast-2jl1) — _01 Apr 2020_
- [Creating Fast APIs In Go Using Fiber](https://dev.to/jozsefsallai/creating-fast-apis-in-go-using-fiber-59m9) — _07 Apr 2020_
- [Building a Basic REST API in Go using Fiber](https://tutorialedge.net/golang/basic-rest-api-go-fiber/) - _23 Apr 2020_
- [📺 Building a REST API using GORM and Fiber](https://youtu.be/Iq2qT0fRhAA) - _25 Apr 2020_
- [🌎 Create a travel list app with Go, Fiber, Angular, MongoDB and Google Cloud Secret Manager](https://blog.yongweilun.me/create-a-travel-list-app-with-go-fiber-angular-mongodb-and-google-cloud-secret-manager-ck9fgxy0p061pcss1xt1ubu8t) - _25 Apr 2020_
- [Fiber v1.9.6 🔥 How to improve performance by 817% and stay fast, flexible and friendly?](https://dev.to/koddr/fiber-v1-9-5-how-to-improve-performance-by-817-and-stay-fast-flexible-and-friendly-2dp6) - _12 May 2020_
## 👍 Berkontribusi
Apabila anda ingin mengucapkan **terima kasih** dan/atau mendukung pengembangan `Fiber`:
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=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%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. Help us to translate our API Documentation via [Crowdin](https://crowdin.com/project/gofiber) [![Crowdin](https://badges.crowdin.net/gofiber/localized.svg)](https://crowdin.com/project/gofiber)
5. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).
## ☕ Supporters
Fiber is an open source project that runs on donations to pay the bills e.g. our domain name, gitbook, netlify and serverless hosting. If you want to support Fiber, you can ☕ [**buy a coffee here**](https://buymeacoff.ee/fenny).
| | User | Donation |
| :---------------------------------------------------------- | :---------------------------------------------- | :------- |
| ![](https://avatars.githubusercontent.com/u/59947262?s=25 ) | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/1094221?s=25 ) | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/186637?s=25 ) | [@candidosales](https://github.com/candidosales)| ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/635852?s=25 ) | [@bihe](https://github.com/bihe) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/307334?s=25 ) | [@justdave](https://github.com/justdave) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/11155743?s=25 ) | [@koddr](https://github.com/koddr) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/29042462?s=25 ) | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/2978730?s=25 ) | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/44171355?s=25 ) | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/5638101?s=25 ) | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/619996?s=25 ) | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31022056?s=25 ) | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31921460?s=25 ) | [@toishy](https://github.com/toishy) | ☕ x 1 |
## ‎‍💻 Code Contributors
<img src="https://opencollective.com/fiber/contributors.svg?width=890&button=false" alt="Code Contributors" style="max-width:100%;">
## ⚠️ License
Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) license (CC BY-SA 4.0 International).
**Third-party library licenses**
- [FastHTTP](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [Schema](https://github.com/gorilla/schema/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)

556
.github/README_ja.md vendored Normal file
View File

@ -0,0 +1,556 @@
<p align="center">
<a href="https://gofiber.io">
<img alt="Fiber" height="125" src="https://github.com/gofiber/docs/blob/master/static/fiber_v2_logo.svg">
</a>
<br>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/en.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ru.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ru.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_es.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/es.svg">
</a>
<!--<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ja.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/jp.svg">
</a>-->
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_pt.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/pt.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_zh-CN.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ch.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_fr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/fr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_tr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/tr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_id.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/id.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_he.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/il.svg">
</a>
<br><br>
<a href="https://github.com/gofiber/fiber/releases">
<img src="https://img.shields.io/github/release/gofiber/fiber?style=flat-square">
</a>
<a href="https://docs.gofiber.io">
<img src="https://img.shields.io/badge/api-docs-blue?style=flat-square">
</a>
<a href="https://pkg.go.dev/github.com/gofiber/fiber?tab=doc">
<img src="https://img.shields.io/badge/go.dev-007d9c?logo=go&logoColor=white&style=flat-square">
</a>
<a href="https://goreportcard.com/report/github.com/gofiber/fiber">
<img src="https://goreportcard.com/badge/github.com/gofiber/fiber?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ATest">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Test?label=tests&style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3AGosec">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Gosec?label=gosec&style=flat-square">
</a>
<a href="https://gofiber.io/discord">
<img src="https://img.shields.io/badge/discord-join%20channel-7289DA?style=flat-square">
</a>
</p>
<p align="center">
<strong>FIber</strong>は、<a href="https://github.com/expressjs/express">Express</a>に触発された<strong>Webフレームワーク</strong>です。<a href="https://golang.org/doc/">Go</a><strong> 最速</strong>のHTTPエンジンである<a href="https://github.com/valyala/fasthttp">Fasthttp</a>で作られています。<strong>ゼロメモリアロケーション</strong><strong>パフォーマンス</strong>を念頭に置いて設計されており、<strong>迅速</strong>な開発をサポートします。
</p>
## ⚡️ クイックスタート
```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)
}
```
## ⚙️ インストール
まず、Goを[ダウンロード](https://golang.org/dl/)してください。 `1.11`以降が必要です。
そして、[`go get`](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them)コマンドを使用してインストールしてください。
```bash
go get -u github.com/gofiber/fiber/...
```
## 🤖 ベンチマーク
これらのテストは[TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks)および[Go Web](https://github.com/smallnest/go-web-framework-benchmark)によって計測を行っています 。すべての結果を表示するには、 [Wiki](https://docs.gofiber.io/benchmarks)にアクセスしてください。
<p float="left" align="middle">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark-pipeline.png" width="49%">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark_alloc.png" width="49%">
</p>
## 🎯 機能
- 堅牢な[ルーティング](https://docs.gofiber.io/routing)
- [静的ファイル](https://docs.gofiber.io/application#static)のサポート
- 究極の[パフォーマンス](https://docs.gofiber.io/benchmarks)
- [低メモリ](https://docs.gofiber.io/benchmarks)フットプリント
- Express [APIエンドポイント](https://docs.gofiber.io/context)
- Middlewareと[Next](https://docs.gofiber.io/context#next)のサポート
- [迅速](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497)なサーバーサイドプログラミング
- [Template engines](https://docs.gofiber.io/middleware#template)
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
- Available in [12 languages](https://docs.gofiber.io/)
- [Fiber](https://docs.gofiber.io/)をもっと知る
## 💡 哲学
[Node.js](https://nodejs.org/en/about/)から[Go](https://golang.org/doc/) に乗り換えようとしている新しいGopherはWebフレームワークやマイクロサービスの構築を始める前に多くを学ばなければなりません。
しかし、 **Webフレームワーク**であるFiberは**ミニマリズム**と**UNIX哲学**をもとに作られているため、新しいGopherはスムーズにGoの世界に入ることができます。
Fiberは人気の高いWebフレームワークであるExpressjsに**インスパイア**されています。
わたしたちは Expressの**手軽さ**とGoの**パフォーマンス**を組み合わせました。
もしも、WebアプリケーションをExpress等のNode.jsフレームワークで実装した経験があれば、多くの方法や原理がとても**馴染み深い**でしょう。
## 👀 例
以下に一般的な例をいくつか示します。他のコード例をご覧になりたい場合は、 [Recipesリポジトリ](https://github.com/gofiber/recipes)または[APIドキュメント](https://docs.gofiber.io)にアクセスしてください。
### Routing
📖 [Routing](https://docs.gofiber.io/#basic-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
📖 [Static](https://docs.gofiber.io/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
📖 [Middleware](https://docs.gofiber.io/routing#middleware)
📖 [Next](https://docs.gofiber.io/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()
})
// GET /api/register
app.Get("/api/list", func(c *fiber.Ctx) {
fmt.Println("Last middleware")
c.Send("Hello, World!")
})
app.Listen(3000)
}
```
<details>
<summary>📚 Show more code examples</summary>
### Template engines
📖 [Settings](https://docs.gofiber.io/application#settings)
📖 [Render](https://docs.gofiber.io/context#render)
📖 [Template](https://docs.gofiber.io/middleware#template)
Fiber supports the default [Go template engine](https://golang.org/pkg/html/template/)
But if you want to use another template engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade).
You can use our [Template Middleware](https://docs.gofiber.io/middleware#template).
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/template"
)
func main() {
// You can setup template engine before initiation app:
app := fiber.New(&fiber.Settings{
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})
// OR after initiation app at any convenient location:
app.Settings.TemplateEngine = template.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
📖 [Group](https://docs.gofiber.io/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
📖 [Logger](https://docs.gofiber.io/middleware#logger)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/logger"
)
func main() {
app := fiber.New()
// Optional logger config
config := logger.Config{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Logger with config
app.Use(logger.New(config))
app.Listen(3000)
}
```
### Cross-Origin Resource Sharing (CORS)
📖 [CORS](https://docs.gofiber.io/middleware#cors)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/cors"
)
func main() {
app := fiber.New()
// CORS with default config
app.Use(cors.New())
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
📖 [HTTP Methods](https://docs.gofiber.io/application#http-methods)
```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
📖 [JSON](https://docs.gofiber.io/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 Upgrade
📖 [Websocket](https://docs.gofiber.io/middleware#websocket)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
app.Get("/ws", websocket.New(func(c *websocket.Conn) {
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
log.Printf("recv: %s", msg)
err = c.WriteMessage(mt, msg)
if err != nil {
log.Println("write:", err)
break
}
}
}))
app.Listen(3000)
// ws://localhost:3000/ws
}
```
### Recover middleware
📖 [Recover](https://docs.gofiber.io/middleware#recover)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/recover"
)
func main() {
app := fiber.New()
// Optional recover config
config := recover.Config{
Handler: func(c *fiber.Ctx, err error) {
c.SendString(err.Error())
c.SendStatus(500)
},
}
// Logger with custom config
app.Use(recover.New(config))
app.Listen(3000)
}
```
</details>
## 🧬 Official Middlewares
For an more _maintainable_ middleware _ecosystem_, we've put official [middlewares](https://docs.gofiber.io/middleware) into separate repositories:
- [gofiber/compression](https://github.com/gofiber/compression)
- [gofiber/basicauth](https://github.com/gofiber/basicauth)
- [gofiber/requestid](https://github.com/gofiber/requestid)
- [gofiber/websocket](https://github.com/gofiber/websocket)
- [gofiber/keyauth](https://github.com/gofiber/keyauth)
- [gofiber/rewrite](https://github.com/gofiber/rewrite)
- [gofiber/recover](https://github.com/gofiber/recover)
- [gofiber/limiter](https://github.com/gofiber/limiter)
- [gofiber/session](https://github.com/gofiber/session)
- [gofiber/adaptor](https://github.com/gofiber/adaptor)
- [gofiber/logger](https://github.com/gofiber/logger)
- [gofiber/helmet](https://github.com/gofiber/helmet)
- [gofiber/embed](https://github.com/gofiber/embed)
- [gofiber/pprof](https://github.com/gofiber/pprof)
- [gofiber/cors](https://github.com/gofiber/cors)
- [gofiber/csrf](https://github.com/gofiber/csrf)
- [gofiber/jwt](https://github.com/gofiber/jwt)
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
## 💬 メディア
- [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) — _03 Feb 2020_
- [Fiber released v1.7! 🎉 What's new and is it 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) — _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) — _03 Mar 2020_
- [Is switching from Express to Fiber worth it? 🤔](https://dev.to/koddr/are-sure-what-your-lovely-web-framework-running-so-fast-2jl1) — _01 Apr 2020_
- [Creating Fast APIs In Go Using Fiber](https://dev.to/jozsefsallai/creating-fast-apis-in-go-using-fiber-59m9) — _07 Apr 2020_
- [Building a Basic REST API in Go using Fiber](https://tutorialedge.net/golang/basic-rest-api-go-fiber/) - _23 Apr 2020_
- [📺 Building a REST API using GORM and Fiber](https://youtu.be/Iq2qT0fRhAA) - _25 Apr 2020_
- [🌎 Create a travel list app with Go, Fiber, Angular, MongoDB and Google Cloud Secret Manager](https://blog.yongweilun.me/create-a-travel-list-app-with-go-fiber-angular-mongodb-and-google-cloud-secret-manager-ck9fgxy0p061pcss1xt1ubu8t) - _25 Apr 2020_
- [Fiber v1.9.6 🔥 How to improve performance by 817% and stay fast, flexible and friendly?](https://dev.to/koddr/fiber-v1-9-5-how-to-improve-performance-by-817-and-stay-fast-flexible-and-friendly-2dp6) - _12 May 2020_
## 👍 貢献する
`Fiber`に開発支援してくださるなら:
1. [GitHub Star](https://github.com/gofiber/fiber/stargazers)をつけてください 。
2. [あなたのTwitterで](https://twitter.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber)プロジェクトについてツイートしてください。
3. [Medium](https://medium.com/) 、 [Dev.to、](https://dev.to/)または個人のブログでレビューまたはチュートリアルを書いてください。
4. Help us to translate our API Documentation via [Crowdin](https://crowdin.com/project/gofiber) [![Crowdin](https://badges.crowdin.net/gofiber/localized.svg)](https://crowdin.com/project/gofiber)
5. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).
## ☕ Supporters
Fiber is an open source project that runs on donations to pay the bills e.g. our domain name, gitbook, netlify and serverless hosting. If you want to support Fiber, you can ☕ [**buy a coffee here**](https://buymeacoff.ee/fenny).
| | User | Donation |
| :---------------------------------------------------------- | :---------------------------------------------- | :------- |
| ![](https://avatars.githubusercontent.com/u/59947262?s=25 ) | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/1094221?s=25 ) | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/186637?s=25 ) | [@candidosales](https://github.com/candidosales)| ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/635852?s=25 ) | [@bihe](https://github.com/bihe) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/307334?s=25 ) | [@justdave](https://github.com/justdave) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/11155743?s=25 ) | [@koddr](https://github.com/koddr) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/29042462?s=25 ) | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/2978730?s=25 ) | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/44171355?s=25 ) | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/5638101?s=25 ) | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/619996?s=25 ) | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31022056?s=25 ) | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31921460?s=25 ) | [@toishy](https://github.com/toishy) | ☕ x 1 |
## ‎‍💻 Code Contributors
<img src="https://opencollective.com/fiber/contributors.svg?width=890&button=false" alt="Code Contributors" style="max-width:100%;">
## ⚠️ License
Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) license (CC BY-SA 4.0 International).
**Third-party library licenses**
- [FastHTTP](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [Schema](https://github.com/gorilla/schema/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)

556
.github/README_ko.md vendored Normal file
View File

@ -0,0 +1,556 @@
<p align="center">
<a href="https://gofiber.io">
<img alt="Fiber" height="125" src="https://github.com/gofiber/docs/blob/master/static/fiber_v2_logo.svg">
</a>
<br>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/en.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ru.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ru.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_es.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/es.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ja.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/jp.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_pt.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/pt.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_zh-CN.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ch.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>
<!--<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>-->
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_fr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/fr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_tr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/tr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_id.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/id.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_he.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/il.svg">
</a>
<br><br>
<a href="https://github.com/gofiber/fiber/releases">
<img src="https://img.shields.io/github/release/gofiber/fiber?style=flat-square">
</a>
<a href="https://docs.gofiber.io">
<img src="https://img.shields.io/badge/api-docs-blue?style=flat-square">
</a>
<a href="https://pkg.go.dev/github.com/gofiber/fiber?tab=doc">
<img src="https://img.shields.io/badge/go.dev-007d9c?logo=go&logoColor=white&style=flat-square">
</a>
<a href="https://goreportcard.com/report/github.com/gofiber/fiber">
<img src="https://goreportcard.com/badge/github.com/gofiber/fiber?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ATest">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Test?label=tests&style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3AGosec">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Gosec?label=gosec&style=flat-square">
</a>
<a href="https://gofiber.io/discord">
<img src="https://img.shields.io/badge/discord-join%20channel-7289DA?style=flat-square">
</a>
</p>
<p align="center">
<b>Fiber</b><a href="https://github.com/expressjs/express">Express</a>에서 영감을 받고, <a href="https://golang.org/doc/">Go</a>를 위한 <b>가장 빠른</b> HTTP 엔진인 <a ref="https://github.com/valyala/fasthttp">Fasthttp</a>를 토대로 만들어진 <b>웹 프레임워크</b> 입니다. <b>비 메모리 할당</b><b>성능</b>을 고려한 <b>빠른</b> 개발을 위해 <b>손쉽게</b> 사용되도록 설계되었습니다.
</p>
## ⚡️ 빠른 시작
```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)
}
```
## ⚙️ 설치
우선, Go를 [다운로드](https://golang.org/dl/)하고 설치합니다. `1.11` 버전 이상이 요구됩니다.
[`go get`](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) 명령어를 이용해 설치가 완료됩니다:
```bash
go get -u github.com/gofiber/fiber/...
```
## 🤖 벤치마크
이 테스트들은 [TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks)와 [Go Web](https://github.com/smallnest/go-web-framework-benchmark)을 통해 측정되었습니다. 만약 모든 결과를 보고 싶다면, [Wiki](https://docs.gofiber.io/benchmarks)를 확인해 주세요.
<p float="left" align="middle">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark-pipeline.png" width="49%">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark_alloc.png" width="49%">
</p>
## 🎯 특징
- 견고한 [라우팅](https://docs.gofiber.io/routing)
- [정적 파일](https://docs.gofiber.io/application#static) 제공
- 뛰어난 [성능](https://docs.gofiber.io/benchmarks)
- [적은 메모리](https://docs.gofiber.io/benchmarks) 공간
- [API 엔드포인트](https://docs.gofiber.io/context)
- 미들웨어 & [Next](https://docs.gofiber.io/context#next) 지원
- [빠른](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) 서버 사이드 프로그래밍
- [Template engines](https://docs.gofiber.io/middleware#template)
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
- Available in [12 languages](https://docs.gofiber.io/)
- 더 알고 싶다면, [Fiber 둘러보기](https://docs.gofiber.io/)
## 💡 철학
[Node.js](https://nodejs.org/en/about/)에서 [Go](https://golang.org/doc/)로 전환하는 새로운 고퍼분들은 웹 어플리케이션이나 마이크로 서비스 개발을 시작할 수 있게 되기 전에 학습 곡선에 시달리고 있습니다. Fiber는 **웹 프레임워크**로서, 새로운 고퍼분들이 따뜻하고 믿음직한 환영을 가지고 빠르게 Go의 세상에 진입할 수 있게 **미니멀리즘**의 개념과 **UNIX 방식**에 따라 개발되었습니다.
Fiber는 인터넷에서 가장 인기있는 웹 프레임워크인 Express에서 **영감을 받았습니다.** 우리는 Express의 **쉬운** 사용과 Go의 **성능**을 결합하였습니다. 만약 당신이 Node.js (Express 또는 비슷한 것을 사용하여) 로 웹 어플리케이션을 개발한 경험이 있다면, 많은 메소드들과 원리들이 **매우 비슷하게** 느껴질 것 입니다.
우리는 **어떤한** 작업, **마감일정**, 개발자의 **기술**이던간에 **빠르고**, **유연하고**, **익숙한** Go 웹 프레임워크를 만들기 위해 사용자들의 [이슈들](https://github.com/gofiber/fiber/issues)을(그리고 모든 인터넷을 통해) **듣고 있습니다**! Express가 자바스크립트 세계에서 하는 것 처럼요.
## 👀 예제
다음은 일반적인 예제들 입니다.
> 더 많은 코드 예제를 보고 싶다면, [Recipes 저장소](https://github.com/gofiber/recipes) 또는 [API 문서](https://docs.gofiber.io)를 방문하세요.
### Routing
📖 [Routing](https://docs.gofiber.io/#basic-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
📖 [Static](https://docs.gofiber.io/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
📖 [Middleware](https://docs.gofiber.io/routing#middleware)
📖 [Next](https://docs.gofiber.io/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()
})
// GET /api/register
app.Get("/api/list", func(c *fiber.Ctx) {
fmt.Println("Last middleware")
c.Send("Hello, World!")
})
app.Listen(3000)
}
```
<details>
<summary>📚 Show more code examples</summary>
### Template engines
📖 [Settings](https://docs.gofiber.io/application#settings)
📖 [Render](https://docs.gofiber.io/context#render)
📖 [Template](https://docs.gofiber.io/middleware#template)
Fiber supports the default [Go template engine](https://golang.org/pkg/html/template/)
But if you want to use another template engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade).
You can use our [Template Middleware](https://docs.gofiber.io/middleware#template).
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/template"
)
func main() {
// You can setup template engine before initiation app:
app := fiber.New(&fiber.Settings{
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})
// OR after initiation app at any convenient location:
app.Settings.TemplateEngine = template.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
📖 [Group](https://docs.gofiber.io/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
📖 [Logger](https://docs.gofiber.io/middleware#logger)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/logger"
)
func main() {
app := fiber.New()
// Optional logger config
config := logger.Config{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Logger with config
app.Use(logger.New(config))
app.Listen(3000)
}
```
### Cross-Origin Resource Sharing (CORS)
📖 [CORS](https://docs.gofiber.io/middleware#cors)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/cors"
)
func main() {
app := fiber.New()
// CORS with default config
app.Use(cors.New())
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
📖 [HTTP Methods](https://docs.gofiber.io/application#http-methods)
```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
📖 [JSON](https://docs.gofiber.io/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 Upgrade
📖 [Websocket](https://docs.gofiber.io/middleware#websocket)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
app.Get("/ws", websocket.New(func(c *websocket.Conn) {
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
log.Printf("recv: %s", msg)
err = c.WriteMessage(mt, msg)
if err != nil {
log.Println("write:", err)
break
}
}
}))
app.Listen(3000)
// ws://localhost:3000/ws
}
```
### Recover middleware
📖 [Recover](https://docs.gofiber.io/middleware#recover)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/recover"
)
func main() {
app := fiber.New()
// Optional recover config
config := recover.Config{
Handler: func(c *fiber.Ctx, err error) {
c.SendString(err.Error())
c.SendStatus(500)
},
}
// Logger with custom config
app.Use(recover.New(config))
app.Listen(3000)
}
```
</details>
## 🧬 Official Middlewares
For an more _maintainable_ middleware _ecosystem_, we've put official [middlewares](https://docs.gofiber.io/middleware) into separate repositories:
- [gofiber/compression](https://github.com/gofiber/compression)
- [gofiber/basicauth](https://github.com/gofiber/basicauth)
- [gofiber/requestid](https://github.com/gofiber/requestid)
- [gofiber/websocket](https://github.com/gofiber/websocket)
- [gofiber/keyauth](https://github.com/gofiber/keyauth)
- [gofiber/rewrite](https://github.com/gofiber/rewrite)
- [gofiber/recover](https://github.com/gofiber/recover)
- [gofiber/limiter](https://github.com/gofiber/limiter)
- [gofiber/session](https://github.com/gofiber/session)
- [gofiber/adaptor](https://github.com/gofiber/adaptor)
- [gofiber/logger](https://github.com/gofiber/logger)
- [gofiber/helmet](https://github.com/gofiber/helmet)
- [gofiber/embed](https://github.com/gofiber/embed)
- [gofiber/pprof](https://github.com/gofiber/pprof)
- [gofiber/cors](https://github.com/gofiber/cors)
- [gofiber/csrf](https://github.com/gofiber/csrf)
- [gofiber/jwt](https://github.com/gofiber/jwt)
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
## 💬 미디어
- [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) — _03 Feb 2020_
- [Fiber released v1.7! 🎉 What's new and is it 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) — _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) — _03 Mar 2020_
- [Is switching from Express to Fiber worth it? 🤔](https://dev.to/koddr/are-sure-what-your-lovely-web-framework-running-so-fast-2jl1) — _01 Apr 2020_
- [Creating Fast APIs In Go Using Fiber](https://dev.to/jozsefsallai/creating-fast-apis-in-go-using-fiber-59m9) — _07 Apr 2020_
- [Building a Basic REST API in Go using Fiber](https://tutorialedge.net/golang/basic-rest-api-go-fiber/) - _23 Apr 2020_
- [📺 Building a REST API using GORM and Fiber](https://youtu.be/Iq2qT0fRhAA) - _25 Apr 2020_
- [🌎 Create a travel list app with Go, Fiber, Angular, MongoDB and Google Cloud Secret Manager](https://blog.yongweilun.me/create-a-travel-list-app-with-go-fiber-angular-mongodb-and-google-cloud-secret-manager-ck9fgxy0p061pcss1xt1ubu8t) - _25 Apr 2020_
- [Fiber v1.9.6 🔥 How to improve performance by 817% and stay fast, flexible and friendly?](https://dev.to/koddr/fiber-v1-9-5-how-to-improve-performance-by-817-and-stay-fast-flexible-and-friendly-2dp6) - _12 May 2020_
## 👍 기여
`Fiber`의 활발한 개발을 지원하고 감사 인사를 하고 싶다면:
1. 프로젝트에 [GitHub Star](https://github.com/gofiber/fiber/stargazers)를 추가하세요.
2. [트위터에서](https://twitter.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber) 프로젝트에 대해 트윗하세요.
3. [Medium](https://medium.com/), [Dev.to](https://dev.to/) 또는 개인 블로그에 리뷰 또는 튜토리얼을 작성하세요.
4. Help us to translate our API Documentation via [Crowdin](https://crowdin.com/project/gofiber) [![Crowdin](https://badges.crowdin.net/gofiber/localized.svg)](https://crowdin.com/project/gofiber)
5. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).
## ☕ Supporters
Fiber is an open source project that runs on donations to pay the bills e.g. our domain name, gitbook, netlify and serverless hosting. If you want to support Fiber, you can ☕ [**buy a coffee here**](https://buymeacoff.ee/fenny).
| | User | Donation |
| :---------------------------------------------------------- | :---------------------------------------------- | :------- |
| ![](https://avatars.githubusercontent.com/u/59947262?s=25 ) | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/1094221?s=25 ) | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/186637?s=25 ) | [@candidosales](https://github.com/candidosales)| ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/635852?s=25 ) | [@bihe](https://github.com/bihe) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/307334?s=25 ) | [@justdave](https://github.com/justdave) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/11155743?s=25 ) | [@koddr](https://github.com/koddr) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/29042462?s=25 ) | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/2978730?s=25 ) | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/44171355?s=25 ) | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/5638101?s=25 ) | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/619996?s=25 ) | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31022056?s=25 ) | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31921460?s=25 ) | [@toishy](https://github.com/toishy) | ☕ x 1 |
## ‎‍💻 Code Contributors
<img src="https://opencollective.com/fiber/contributors.svg?width=890&button=false" alt="Code Contributors" style="max-width:100%;">
## ⚠️ License
Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) license (CC BY-SA 4.0 International).
**Third-party library licenses**
- [FastHTTP](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [Schema](https://github.com/gorilla/schema/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)

556
.github/README_nl.md vendored Normal file
View File

@ -0,0 +1,556 @@
<p align="center">
<a href="https://fiber.wiki">
<img alt="Fiber" height="125" src="https://github.com/gofiber/docs/blob/master/static/fiber_v2_logo.svg">
</a>
<br>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/en.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ru.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ru.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_es.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/es.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ja.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/jp.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_pt.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/pt.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_zh-CN.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ch.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>
<!--<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>-->
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_fr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/fr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_tr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/tr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_id.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/id.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_he.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/il.svg">
</a>
<br><br>
<a href="https://github.com/gofiber/fiber/releases">
<img src="https://img.shields.io/github/release/gofiber/fiber?style=flat-square">
</a>
<a href="https://docs.gofiber.io">
<img src="https://img.shields.io/badge/api-docs-blue?style=flat-square">
</a>
<a href="https://pkg.go.dev/github.com/gofiber/fiber?tab=doc">
<img src="https://img.shields.io/badge/go.dev-007d9c?logo=go&logoColor=white&style=flat-square">
</a>
<a href="https://goreportcard.com/report/github.com/gofiber/fiber">
<img src="https://goreportcard.com/badge/github.com/gofiber/fiber?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ATest">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Test?label=tests&style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3AGosec">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Gosec?label=gosec&style=flat-square">
</a>
<a href="https://gofiber.io/discord">
<img src="https://img.shields.io/badge/discord-join%20channel-7289DA?style=flat-square">
</a>
</p>
<p align="center">
<b>Fiber</b> is een <b>web framework</b> geïnspireerd door <a href="https://github.com/expressjs/express">Express</a> gebouwd bovenop <a href="https://github.com/valyala/fasthttp">Fasthttp</a>, de <b>snelste</b> HTTP-engine voor <a href="https://golang.org/doc/">Go</a>. Ontworpen om <b>snelle</b> ontwikkeling <b>gemakkelijker</b> te maken <b>zonder geheugenallocatie</b> tezamen met <b>hoge prestaties</b>.
</p>
## ⚡️ Bliksemsnelle start
```go
package main
import "github.com/gofiber/fiber"
func main() {
app := fiber.New()
app.Get("/", func(c *fiber.Ctx) {
c.Send("Hallo, Wereld!")
})
app.Listen(3000)
}
```
## ⚙️ Installatie
Allereerst, [download](https://golang.org/dl/) en installeer Go. `1.11` of hoger is vereist.
Installatie wordt gedaan met behulp van het [`go get`](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) commando:
```bash
go get -u github.com/gofiber/fiber
```
## 🤖 Benchmarks
Deze tests zijn uitgevoerd door [TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks) en [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Bezoek onze [Wiki](https://fiber.wiki/benchmarks) voor alle benchmark resultaten.
<p float="left" align="middle">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark-pipeline.png" width="49%">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark_alloc.png" width="49%">
</p>
## 🎯 Features
- Robuuste [routing](https://fiber.wiki/routing)
- Serveer [statische bestanden](https://fiber.wiki/application#static)
- Extreme [prestaties](https://fiber.wiki/benchmarks)
- [Weinig geheugenruimte](https://fiber.wiki/benchmarks)
- [API endpoints](https://fiber.wiki/context)
- [Middleware](https://fiber.wiki/middleware) & [Next](https://fiber.wiki/context#next) ondersteuning
- [Snelle](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) server-side programmering
- [Template engines](https://fiber.wiki/middleware#template)
- [WebSocket ondersteuning](https://fiber.wiki/middleware#websocket)
- [Rate Limiter](https://fiber.wiki/middleware#limiter)
- Vertaald in 12 andere talen
- En nog veel meer, [ontdek Fiber](https://fiber.wiki/)
## 💡 Filosofie
Nieuwe gophers die de overstap maken van [Node.js](https://nodejs.org/en/about/) naar [Go](https://golang.org/doc/), hebben te maken met een leercurve voordat ze kunnen beginnen met het bouwen van hun webapplicaties of microservices. Fiber, als een **web framework**, is gebouwd met het idee van **minimalisme** en volgt de **UNIX-manier**, zodat nieuwe gophers snel de wereld van Go kunnen betreden met een warm en vertrouwd welkom.\
Fiber is **geïnspireerd** door Express, het populairste webframework op internet. We hebben het **gemak** van Express gecombineerd met de **onbewerkte prestaties** van Go. Als je ooit een webapplicatie in Node.js hebt geïmplementeerd (_zoals Express of vergelijkbaar_), dan zullen veel methoden en principes **heel gewoon** voor je lijken.
We **luisteren** naar onze gebruikers in [issues](https://github.com/gofiber/fiber/issues) (_en overal op het internet_) om een **snelle**, **flexibele** en **vriendelijk** Go web framework te maken voor **elke** taak, **deadline** en ontwikkelaar **vaardigheid**! Net zoals Express dat doet in de JavaScript-wereld.
## 👀 Voorbeelden
Hieronder staan enkele van de meest voorkomende voorbeelden.
> Bekijk ons [Recepten repository](https://github.com/gofiber/recipes) voor meer voorbeelden met code of bezoek onze [API documentatie](https://fiber.wiki).
### Routing
📖 [Routing](https://docs.gofiber.io/#basic-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
📖 [Static](https://docs.gofiber.io/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
📖 [Middleware](https://docs.gofiber.io/routing#middleware)
📖 [Next](https://docs.gofiber.io/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()
})
// GET /api/register
app.Get("/api/list", func(c *fiber.Ctx) {
fmt.Println("Last middleware")
c.Send("Hello, World!")
})
app.Listen(3000)
}
```
<details>
<summary>📚 Show more code examples</summary>
### Template engines
📖 [Settings](https://docs.gofiber.io/application#settings)
📖 [Render](https://docs.gofiber.io/context#render)
📖 [Template](https://docs.gofiber.io/middleware#template)
Fiber supports the default [Go template engine](https://golang.org/pkg/html/template/)
But if you want to use another template engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade).
You can use our [Template Middleware](https://docs.gofiber.io/middleware#template).
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/template"
)
func main() {
// You can setup template engine before initiation app:
app := fiber.New(&fiber.Settings{
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})
// OR after initiation app at any convenient location:
app.Settings.TemplateEngine = template.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
📖 [Group](https://docs.gofiber.io/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
📖 [Logger](https://docs.gofiber.io/middleware#logger)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/logger"
)
func main() {
app := fiber.New()
// Optional logger config
config := logger.Config{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Logger with config
app.Use(logger.New(config))
app.Listen(3000)
}
```
### Cross-Origin Resource Sharing (CORS)
📖 [CORS](https://docs.gofiber.io/middleware#cors)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/cors"
)
func main() {
app := fiber.New()
// CORS with default config
app.Use(cors.New())
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
📖 [HTTP Methods](https://docs.gofiber.io/application#http-methods)
```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
📖 [JSON](https://docs.gofiber.io/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 Upgrade
📖 [Websocket](https://docs.gofiber.io/middleware#websocket)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
app.Get("/ws", websocket.New(func(c *websocket.Conn) {
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
log.Printf("recv: %s", msg)
err = c.WriteMessage(mt, msg)
if err != nil {
log.Println("write:", err)
break
}
}
}))
app.Listen(3000)
// ws://localhost:3000/ws
}
```
### Recover middleware
📖 [Recover](https://docs.gofiber.io/middleware#recover)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/recover"
)
func main() {
app := fiber.New()
// Optional recover config
config := recover.Config{
Handler: func(c *fiber.Ctx, err error) {
c.SendString(err.Error())
c.SendStatus(500)
},
}
// Logger with custom config
app.Use(recover.New(config))
app.Listen(3000)
}
```
</details>
## 🧬 Official Middlewares
For an more _maintainable_ middleware _ecosystem_, we've put official [middlewares](https://docs.gofiber.io/middleware) into separate repositories:
- [gofiber/compression](https://github.com/gofiber/compression)
- [gofiber/basicauth](https://github.com/gofiber/basicauth)
- [gofiber/requestid](https://github.com/gofiber/requestid)
- [gofiber/websocket](https://github.com/gofiber/websocket)
- [gofiber/keyauth](https://github.com/gofiber/keyauth)
- [gofiber/rewrite](https://github.com/gofiber/rewrite)
- [gofiber/recover](https://github.com/gofiber/recover)
- [gofiber/limiter](https://github.com/gofiber/limiter)
- [gofiber/session](https://github.com/gofiber/session)
- [gofiber/adaptor](https://github.com/gofiber/adaptor)
- [gofiber/logger](https://github.com/gofiber/logger)
- [gofiber/helmet](https://github.com/gofiber/helmet)
- [gofiber/embed](https://github.com/gofiber/embed)
- [gofiber/pprof](https://github.com/gofiber/pprof)
- [gofiber/cors](https://github.com/gofiber/cors)
- [gofiber/csrf](https://github.com/gofiber/csrf)
- [gofiber/jwt](https://github.com/gofiber/jwt)
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
## 💬 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) — _03 Feb 2020_
- [Fiber released v1.7! 🎉 What's new and is it 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) — _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) — _03 Mar 2020_
- [Is switching from Express to Fiber worth it? 🤔](https://dev.to/koddr/are-sure-what-your-lovely-web-framework-running-so-fast-2jl1) — _01 Apr 2020_
- [Creating Fast APIs In Go Using Fiber](https://dev.to/jozsefsallai/creating-fast-apis-in-go-using-fiber-59m9) — _07 Apr 2020_
- [Building a Basic REST API in Go using Fiber](https://tutorialedge.net/golang/basic-rest-api-go-fiber/) - _23 Apr 2020_
- [📺 Building a REST API using GORM and Fiber](https://youtu.be/Iq2qT0fRhAA) - _25 Apr 2020_
- [🌎 Create a travel list app with Go, Fiber, Angular, MongoDB and Google Cloud Secret Manager](https://blog.yongweilun.me/create-a-travel-list-app-with-go-fiber-angular-mongodb-and-google-cloud-secret-manager-ck9fgxy0p061pcss1xt1ubu8t) - _25 Apr 2020_
- [Fiber v1.9.6 🔥 How to improve performance by 817% and stay fast, flexible and friendly?](https://dev.to/koddr/fiber-v1-9-5-how-to-improve-performance-by-817-and-stay-fast-flexible-and-friendly-2dp6) - _12 May 2020_
## 👍 Bijdragen
Om de actieve ontwikkelingen van `Fiber` te ondersteunen of om een **bedankje** te geven:
1. Voeg een [GitHub Star](https://github.com/gofiber/fiber/stargazers) toe aan het project.
2. Tweet over het project [op je Twitter account](https://twitter.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
3. Schrijf een recensie of tutorial op [Medium](https://medium.com/), [Dev.to](https://dev.to/) of een persoonlijke blog.
4. Help us to translate our API Documentation via [Crowdin](https://crowdin.com/project/gofiber) [![Crowdin](https://badges.crowdin.net/gofiber/localized.svg)](https://crowdin.com/project/gofiber)
5. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).
## ☕ Supporters
Fiber is an open source project that runs on donations to pay the bills e.g. our domain name, gitbook, netlify and serverless hosting. If you want to support Fiber, you can ☕ [**buy a coffee here**](https://buymeacoff.ee/fenny).
| | User | Donation |
| :---------------------------------------------------------- | :---------------------------------------------- | :------- |
| ![](https://avatars.githubusercontent.com/u/59947262?s=25 ) | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/1094221?s=25 ) | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/186637?s=25 ) | [@candidosales](https://github.com/candidosales)| ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/635852?s=25 ) | [@bihe](https://github.com/bihe) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/307334?s=25 ) | [@justdave](https://github.com/justdave) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/11155743?s=25 ) | [@koddr](https://github.com/koddr) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/29042462?s=25 ) | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/2978730?s=25 ) | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/44171355?s=25 ) | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/5638101?s=25 ) | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/619996?s=25 ) | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31022056?s=25 ) | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31921460?s=25 ) | [@toishy](https://github.com/toishy) | ☕ x 1 |
## ‎‍💻 Code Contributors
<img src="https://opencollective.com/fiber/contributors.svg?width=890&button=false" alt="Code Contributors" style="max-width:100%;">
## ⚠️ License
Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) license (CC BY-SA 4.0 International).
**Third-party library licenses**
- [FastHTTP](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [Schema](https://github.com/gorilla/schema/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)

552
.github/README_pt.md vendored Normal file
View File

@ -0,0 +1,552 @@
<p align="center">
<a href="https://gofiber.io">
<img alt="Fiber" height="125" src="https://github.com/gofiber/docs/blob/master/static/fiber_v2_logo.svg">
</a>
<br>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/en.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ru.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ru.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_es.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/es.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ja.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/jp.svg">
</a>
<!--<a href="https://github.com/gofiber/fiber/blob/master/.github/README_pt.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/pt.svg">
</a>-->
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_zh-CN.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ch.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_fr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/fr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_tr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/tr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_id.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/id.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_he.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/il.svg">
</a>
<br><br>
<a href="https://github.com/gofiber/fiber/releases">
<img src="https://img.shields.io/github/release/gofiber/fiber?style=flat-square">
</a>
<a href="https://docs.gofiber.io">
<img src="https://img.shields.io/badge/api-docs-blue?style=flat-square">
</a>
<a href="https://pkg.go.dev/github.com/gofiber/fiber?tab=doc">
<img src="https://img.shields.io/badge/go.dev-007d9c?logo=go&logoColor=white&style=flat-square">
</a>
<a href="https://goreportcard.com/report/github.com/gofiber/fiber">
<img src="https://goreportcard.com/badge/github.com/gofiber/fiber?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ATest">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Test?label=tests&style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3AGosec">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Gosec?label=gosec&style=flat-square">
</a>
<a href="https://gofiber.io/discord">
<img src="https://img.shields.io/badge/discord-join%20channel-7289DA?style=flat-square">
</a>
</p>
<p align="center">
<b>Fiber</b> é um <b>framework web</b> inspirado no <a href="https://github.com/expressjs/express">Express</a>, construído sobre o <a href="https://github.com/valyala/fasthttp">Fasthttp</a>, o motor HTTP <b>mais rápido</b> do <a href="https://golang.org/doc/">Go</a>. Projetado para <b>facilitar</b> e <b>acelerar</b> o desenvolvimento, com <b>zero de alocação de memória</b> e <b>desempenho</b> em mente.
</p>
## ⚡️ Início rápido
```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)
}
```
## ⚙️ Instalação
Primeiro de tudo, faça o [download](https://golang.org/dl/) e instale o Go. É necessário a versão `1.11` ou superior.
A instalação é feita usando o comando [`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
Esses testes são realizados pelo [TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks) e [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Se você quiser ver todos os resultados, visite nosso [Wiki](https://docs.gofiber.io/benchmarks) .
<p float="left" align="middle">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark-pipeline.png" width="49%">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark_alloc.png" width="49%">
</p>
## 🎯 Recursos
- [Roteamento](https://docs.gofiber.io/routing) robusto
- Servir [arquivos estáticos](https://docs.gofiber.io/application#static)
- [Desempenho](https://docs.gofiber.io/benchmarks) extremo
- [Baixo consumo de memória](https://docs.gofiber.io/benchmarks)
- [API de rotas](https://docs.gofiber.io/context)
- Suporte para Middleware e [Next](https://docs.gofiber.io/context#next)
- Programação [rápida](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) de aplicações de servidor
- [Template engines](https://docs.gofiber.io/middleware#template)
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
- Available in [12 languages](https://docs.gofiber.io/)
- E muito mais, [explore o Fiber](https://docs.gofiber.io/)
## 💡 Filosofia
Os novos gophers que mudaram do [Node.js](https://nodejs.org/en/about/) para o [Go](https://golang.org/doc/) estão tendo que lidar com uma curva de aprendizado antes que possam começar a criar seus aplicativos web ou microsserviços. O Fiber, como um **framework web**, foi criado com a ideia de ser **minimalista** e seguindo o **caminho UNIX**, para que novos gophers possam, rapidamente, entrar no mundo do Go com uma recepção calorosa e confiável.
O Fiber é **inspirado** no Express, o framework web mais popular da Internet. Combinamos a **facilidade** do Express e o **desempenho bruto** do Go. Se você já implementou um aplicativo web com Node.js ( _usando Express.js ou similar_ ), então muitos métodos e princípios parecerão **muito comuns** para você.
## 👀 Exemplos
Listados abaixo estão alguns exemplos comuns. Se você quiser ver mais exemplos de código, visite nosso [repositório de receitas](https://github.com/gofiber/recipes) ou a [documentação da API](https://docs.gofiber.io).
### Routing
📖 [Routing](https://docs.gofiber.io/#basic-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
📖 [Static](https://docs.gofiber.io/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
📖 [Middleware](https://docs.gofiber.io/routing#middleware)
📖 [Next](https://docs.gofiber.io/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()
})
// GET /api/register
app.Get("/api/list", func(c *fiber.Ctx) {
fmt.Println("Last middleware")
c.Send("Hello, World!")
})
app.Listen(3000)
}
```
<details>
<summary>📚 Show more code examples</summary>
### Template engines
📖 [Settings](https://docs.gofiber.io/application#settings)
📖 [Render](https://docs.gofiber.io/context#render)
📖 [Template](https://docs.gofiber.io/middleware#template)
Fiber supports the default [Go template engine](https://golang.org/pkg/html/template/)
But if you want to use another template engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade).
You can use our [Template Middleware](https://docs.gofiber.io/middleware#template).
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/template"
)
func main() {
// You can setup template engine before initiation app:
app := fiber.New(&fiber.Settings{
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})
// OR after initiation app at any convenient location:
app.Settings.TemplateEngine = template.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
📖 [Group](https://docs.gofiber.io/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
📖 [Logger](https://docs.gofiber.io/middleware#logger)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/logger"
)
func main() {
app := fiber.New()
// Optional logger config
config := logger.Config{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Logger with config
app.Use(logger.New(config))
app.Listen(3000)
}
```
### Cross-Origin Resource Sharing (CORS)
📖 [CORS](https://docs.gofiber.io/middleware#cors)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/cors"
)
func main() {
app := fiber.New()
// CORS with default config
app.Use(cors.New())
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
📖 [HTTP Methods](https://docs.gofiber.io/application#http-methods)
```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
📖 [JSON](https://docs.gofiber.io/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 Upgrade
📖 [Websocket](https://docs.gofiber.io/middleware#websocket)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
app.Get("/ws", websocket.New(func(c *websocket.Conn) {
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
log.Printf("recv: %s", msg)
err = c.WriteMessage(mt, msg)
if err != nil {
log.Println("write:", err)
break
}
}
}))
app.Listen(3000)
// ws://localhost:3000/ws
}
```
### Recover middleware
📖 [Recover](https://docs.gofiber.io/middleware#recover)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/recover"
)
func main() {
app := fiber.New()
// Optional recover config
config := recover.Config{
Handler: func(c *fiber.Ctx, err error) {
c.SendString(err.Error())
c.SendStatus(500)
},
}
// Logger with custom config
app.Use(recover.New(config))
app.Listen(3000)
}
```
</details>
## 🧬 Official Middlewares
For an more _maintainable_ middleware _ecosystem_, we've put official [middlewares](https://docs.gofiber.io/middleware) into separate repositories:
- [gofiber/compression](https://github.com/gofiber/compression)
- [gofiber/basicauth](https://github.com/gofiber/basicauth)
- [gofiber/requestid](https://github.com/gofiber/requestid)
- [gofiber/websocket](https://github.com/gofiber/websocket)
- [gofiber/keyauth](https://github.com/gofiber/keyauth)
- [gofiber/rewrite](https://github.com/gofiber/rewrite)
- [gofiber/recover](https://github.com/gofiber/recover)
- [gofiber/limiter](https://github.com/gofiber/limiter)
- [gofiber/session](https://github.com/gofiber/session)
- [gofiber/adaptor](https://github.com/gofiber/adaptor)
- [gofiber/logger](https://github.com/gofiber/logger)
- [gofiber/helmet](https://github.com/gofiber/helmet)
- [gofiber/embed](https://github.com/gofiber/embed)
- [gofiber/pprof](https://github.com/gofiber/pprof)
- [gofiber/cors](https://github.com/gofiber/cors)
- [gofiber/csrf](https://github.com/gofiber/csrf)
- [gofiber/jwt](https://github.com/gofiber/jwt)
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
## 💬 Mídia
- [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) — _03 Feb 2020_
- [Fiber released v1.7! 🎉 What's new and is it 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) — _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) — _03 Mar 2020_
- [Is switching from Express to Fiber worth it? 🤔](https://dev.to/koddr/are-sure-what-your-lovely-web-framework-running-so-fast-2jl1) — _01 Apr 2020_
- [Creating Fast APIs In Go Using Fiber](https://dev.to/jozsefsallai/creating-fast-apis-in-go-using-fiber-59m9) — _07 Apr 2020_
- [Building a Basic REST API in Go using Fiber](https://tutorialedge.net/golang/basic-rest-api-go-fiber/) - _23 Apr 2020_
- [📺 Building a REST API using GORM and Fiber](https://youtu.be/Iq2qT0fRhAA) - _25 Apr 2020_
- [🌎 Create a travel list app with Go, Fiber, Angular, MongoDB and Google Cloud Secret Manager](https://blog.yongweilun.me/create-a-travel-list-app-with-go-fiber-angular-mongodb-and-google-cloud-secret-manager-ck9fgxy0p061pcss1xt1ubu8t) - _25 Apr 2020_
- [Fiber v1.9.6 🔥 How to improve performance by 817% and stay fast, flexible and friendly?](https://dev.to/koddr/fiber-v1-9-5-how-to-improve-performance-by-817-and-stay-fast-flexible-and-friendly-2dp6) - _12 May 2020_
## 👍 Contribuindo
Se você quer **agradecer** e/ou apoiar o desenvolvimento ativo do `Fiber`:
1. Deixe uma [estrela no GitHub](https://github.com/gofiber/fiber/stargazers) do projeto.
2. Tweet sobre o projeto [no seu Twitter](https://twitter.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
3. Escreva um review ou tutorial no [Medium](https://medium.com/), [Dev.to](https://dev.to/) ou blog pessoal.
4. Help us to translate our API Documentation via [Crowdin](https://crowdin.com/project/gofiber) [![Crowdin](https://badges.crowdin.net/gofiber/localized.svg)](https://crowdin.com/project/gofiber)
5. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).
## ☕ Supporters
Fiber is an open source project that runs on donations to pay the bills e.g. our domain name, gitbook, netlify and serverless hosting. If you want to support Fiber, you can ☕ [**buy a coffee here**](https://buymeacoff.ee/fenny).
| | User | Donation |
| :---------------------------------------------------------- | :---------------------------------------------- | :------- |
| ![](https://avatars.githubusercontent.com/u/59947262?s=25 ) | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/1094221?s=25 ) | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/186637?s=25 ) | [@candidosales](https://github.com/candidosales)| ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/635852?s=25 ) | [@bihe](https://github.com/bihe) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/307334?s=25 ) | [@justdave](https://github.com/justdave) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/11155743?s=25 ) | [@koddr](https://github.com/koddr) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/29042462?s=25 ) | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/2978730?s=25 ) | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/44171355?s=25 ) | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/5638101?s=25 ) | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/619996?s=25 ) | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31022056?s=25 ) | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31921460?s=25 ) | [@toishy](https://github.com/toishy) | ☕ x 1 |
## ‎‍💻 Code Contributors
<img src="https://opencollective.com/fiber/contributors.svg?width=890&button=false" alt="Code Contributors" style="max-width:100%;">
## ⚠️ License
Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) license (CC BY-SA 4.0 International).
**Third-party library licenses**
- [FastHTTP](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [Schema](https://github.com/gorilla/schema/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)

557
.github/README_ru.md vendored Normal file
View File

@ -0,0 +1,557 @@
<p align="center">
<a href="https://gofiber.io">
<img alt="Fiber" height="125" src="https://github.com/gofiber/docs/blob/master/static/fiber_v2_logo.svg">
</a>
<br>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/en.svg">
</a>
<!--<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ru.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ru.svg">
</a>-->
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_es.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/es.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ja.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/jp.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_pt.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/pt.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_zh-CN.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ch.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_fr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/fr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_tr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/tr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_id.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/id.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_he.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/il.svg">
</a>
<br><br>
<a href="https://github.com/gofiber/fiber/releases">
<img src="https://img.shields.io/github/release/gofiber/fiber?style=flat-square">
</a>
<a href="https://docs.gofiber.io">
<img src="https://img.shields.io/badge/api-docs-blue?style=flat-square">
</a>
<a href="https://pkg.go.dev/github.com/gofiber/fiber?tab=doc">
<img src="https://img.shields.io/badge/go.dev-007d9c?logo=go&logoColor=white&style=flat-square">
</a>
<a href="https://goreportcard.com/report/github.com/gofiber/fiber">
<img src="https://goreportcard.com/badge/github.com/gofiber/fiber?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ATest">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Test?label=tests&style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3AGosec">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Gosec?label=gosec&style=flat-square">
</a>
<a href="https://gofiber.io/discord">
<img src="https://img.shields.io/badge/discord-join%20channel-7289DA?style=flat-square">
</a>
</p>
<p align="center">
<strong>Fiber</strong> — это <strong>веб фреймворк</strong>, который был вдохновлен <a href="https://github.com/expressjs/express">Express</a> и основан на <a href="https://github.com/valyala/fasthttp">Fasthttp</a>, самом быстром HTTP-движке написанном на <a href="https://golang.org/doc/">Go</a>. Фреймворк был разработан с целью <strong>упростить</strong> процесс <strong>быстрой</strong> разработки <strong>высокопроизводительных</strong> веб-приложений с <strong>нулевым распределением памяти</strong>.
</p>
## ⚡️ Быстрый старт
```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)
}
```
## ⚙️ Установка
Прежде всего, [скачайте](https://golang.org/dl/) и установите Go. Версия **1.11** или выше.
Установка выполняется с помощью команды [`go get`](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them):
```bash
go get -u github.com/gofiber/fiber
```
## 🤖 Бенчмарки
Тестирование проводилось с помощью [TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks) и [Go Web](https://github.com/smallnest/go-web-framework-benchmark). Если вы хотите увидеть все результаты, пожалуйста, посетите наш [Wiki](https://docs.gofiber.io/benchmarks).
<p float="left" align="middle">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark-pipeline.png" width="49%">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark_alloc.png" width="49%">
</p>
## 🎯 Особенности
- Надежная [маршрутизация](https://docs.gofiber.io/routing)
- Доступ к [статичным файлам](https://docs.gofiber.io/application#static)
- Экстремальная [производительность](https://docs.gofiber.io/benchmarks)
- [Низкий объем потребления памяти](https://docs.gofiber.io/benchmarks)
- [Эндпоинты](https://docs.gofiber.io/context), как в [API](https://docs.gofiber.io/context) Express
- [Middleware](https://docs.gofiber.io/middleware) и поддержка [Next](https://docs.gofiber.io/context#next)
- [Быстрое](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) программирование на стороне сервера
- [Template engines](https://docs.gofiber.io/middleware#template)
- [Поддержка WebSocket](https://docs.gofiber.io/middleware#websocket)
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
- Документация доступна на [12 языках](https://docs.gofiber.io/)
- И многое другое, [посетите наш Wiki](https://docs.gofiber.io/)
## 💡 Философия
Новые Go-программисты, которые переключаются с [Node.js](https://nodejs.org/en/about/) на [Go](https://golang.org/doc/), имеют дело с очень извилистой кривой обучения, прежде чем они смогут начать создавать свои веб-приложения или микросервисы. Fiber, как **веб-фреймворк**, был создан с идеей **минимализма** и следовал **принципу UNIX**, так что новички смогут быстро войти в мир Go без особых проблем.
Fiber **вдохновлен** Express, самым популярным веб фреймворком в Интернете. Мы объединили **простоту** Express и **чистую производительность** Go. Если вы когда-либо реализовывали веб-приложение на Node.js (*с использованием Express или аналогичного фреймворка*), то многие методы и принципы покажутся вам **очень знакомыми**.
Мы **прислушиваемся** к нашим пользователям в [issues](https://github.com/gofiber/fiber/issues), Discord [канале](https://gofiber.io/discord) _и в остальном Интернете_, чтобы создать **быстрый**, **гибкий** и **дружелюбный** веб фреймворк на Go для **любых** задач, **дедлайнов** и **уровней** разработчиков! Как это делает Express в мире JavaScript.
## 👀 Примеры
Ниже перечислены некоторые из распространенных примеров. Если вы хотите увидеть больше примеров кода, пожалуйста, посетите наш [репозиторий рецептов](https://github.com/gofiber/recipes) или [документацию по API](https://docs.gofiber.io).
### Routing
📖 [Routing](https://docs.gofiber.io/#basic-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
📖 [Static](https://docs.gofiber.io/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
📖 [Middleware](https://docs.gofiber.io/routing#middleware)
📖 [Next](https://docs.gofiber.io/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()
})
// GET /api/register
app.Get("/api/list", func(c *fiber.Ctx) {
fmt.Println("Last middleware")
c.Send("Hello, World!")
})
app.Listen(3000)
}
```
<details>
<summary>📚 Показать больше примеров кода</summary>
### Template engines
📖 [Settings](https://docs.gofiber.io/application#settings)
📖 [Render](https://docs.gofiber.io/context#render)
📖 [Template](https://docs.gofiber.io/middleware#template)
Fiber поддерживает [Go template engine](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).
Вы можете использовать [Template Middleware](https://docs.gofiber.io/middleware#template).
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/template"
)
func main() {
// You can setup template engine before initiation app:
app := fiber.New(&fiber.Settings{
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})
// OR after initiation app at any convenient location:
app.Settings.TemplateEngine = template.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
📖 [Group](https://docs.gofiber.io/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
📖 [Logger](https://docs.gofiber.io/middleware#logger)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/logger"
)
func main() {
app := fiber.New()
// Optional logger config
config := logger.Config{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Logger with config
app.Use(logger.New(config))
app.Listen(3000)
}
```
### Cross-Origin Resource Sharing (CORS)
📖 [CORS](https://docs.gofiber.io/middleware#cors)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/cors"
)
func main() {
app := fiber.New()
// CORS with default config
app.Use(cors.New())
app.Listen(3000)
}
```
Проверем CORS, присвоив домен в заголовок `Origin`, отличный от `localhost`:
```bash
curl -H "Origin: http://example.com" --verbose http://localhost:3000
```
### Custom 404 response
📖 [HTTP Methods](https://docs.gofiber.io/application#http-methods)
```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
📖 [JSON](https://docs.gofiber.io/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 Upgrade
📖 [Websocket](https://docs.gofiber.io/middleware#websocket)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
app.Get("/ws", websocket.New(func(c *websocket.Conn) {
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
log.Printf("recv: %s", msg)
err = c.WriteMessage(mt, msg)
if err != nil {
log.Println("write:", err)
break
}
}
}))
app.Listen(3000)
// ws://localhost:3000/ws
}
```
### Recover middleware
📖 [Recover](https://docs.gofiber.io/middleware#recover)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/recover"
)
func main() {
app := fiber.New()
// Optional recover config
config := recover.Config{
Handler: func(c *fiber.Ctx, err error) {
c.SendString(err.Error())
c.SendStatus(500)
},
}
// Logger with custom config
app.Use(recover.New(config))
app.Listen(3000)
}
```
</details>
## 🧬 Официальные Middlewares
Чтобы создать более _поддерживаемую_ middleware _экосистему_, мы вынесли [middlewares](https://docs.gofiber.io/middleware) в отдельные репозитории:
- [gofiber/compression](https://github.com/gofiber/compression)
- [gofiber/basicauth](https://github.com/gofiber/basicauth)
- [gofiber/requestid](https://github.com/gofiber/requestid)
- [gofiber/websocket](https://github.com/gofiber/websocket)
- [gofiber/keyauth](https://github.com/gofiber/keyauth)
- [gofiber/rewrite](https://github.com/gofiber/rewrite)
- [gofiber/recover](https://github.com/gofiber/recover)
- [gofiber/limiter](https://github.com/gofiber/limiter)
- [gofiber/session](https://github.com/gofiber/session)
- [gofiber/adaptor](https://github.com/gofiber/adaptor)
- [gofiber/logger](https://github.com/gofiber/logger)
- [gofiber/helmet](https://github.com/gofiber/helmet)
- [gofiber/embed](https://github.com/gofiber/embed)
- [gofiber/pprof](https://github.com/gofiber/pprof)
- [gofiber/cors](https://github.com/gofiber/cors)
- [gofiber/csrf](https://github.com/gofiber/csrf)
- [gofiber/jwt](https://github.com/gofiber/jwt)
## 🌱 Middlewares от сторонних разработчиков
Это список middlewares, созданных сообществом Fiber. Пожалуйста, [создайте PR](https://github.com/gofiber/fiber/pulls), если хотите добавить в этот список свой или известный вам middleware для веб фреймворка Fiber!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
## 💬 Медиа
- [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) — _03 Feb 2020_
- [Fiber released v1.7! 🎉 What's new and is it 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) — _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) — _03 Mar 2020_
- [Is switching from Express to Fiber worth it? 🤔](https://dev.to/koddr/are-sure-what-your-lovely-web-framework-running-so-fast-2jl1) — _01 Apr 2020_
- [Creating Fast APIs In Go Using Fiber](https://dev.to/jozsefsallai/creating-fast-apis-in-go-using-fiber-59m9) — _07 Apr 2020_
- [Building a Basic REST API in Go using Fiber](https://tutorialedge.net/golang/basic-rest-api-go-fiber/) - _23 Apr 2020_
- [📺 Building a REST API using GORM and Fiber](https://youtu.be/Iq2qT0fRhAA) - _25 Apr 2020_
- [🌎 Create a travel list app with Go, Fiber, Angular, MongoDB and Google Cloud Secret Manager](https://blog.yongweilun.me/create-a-travel-list-app-with-go-fiber-angular-mongodb-and-google-cloud-secret-manager-ck9fgxy0p061pcss1xt1ubu8t) - _25 Apr 2020_
- [Fiber v1.9.6 🔥 How to improve performance by 817% and stay fast, flexible and friendly?](https://dev.to/koddr/fiber-v1-9-5-how-to-improve-performance-by-817-and-stay-fast-flexible-and-friendly-2dp6) - _12 May 2020_
## 👍 Помощь проекту
Если вы хотите сказать **спасибо** и/или поддержать активное развитие `Fiber`:
1. Добавьте [GitHub Star](https://github.com/gofiber/fiber/stargazers) в проект.
2. Напишите о проекте [в вашем Twitter](https://twitter.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber).
3. Сделайте обзор фреймворка на [Medium](https://medium.com/), [Dev.to](https://dev.to/) или в личном блоге.
4. Помогите перевести нашу API документацию на платформе [Crowdin](https://crowdin.com/project/gofiber) [![Crowdin](https://badges.crowdin.net/gofiber/localized.svg)](https://crowdin.com/project/gofiber)
5. Поддержите проект, купив [чашку кофе](https://buymeacoff.ee/fenny).
## ☕ Поддержка проекта
Fiber — это проект с открытым исходным кодом, который работает на пожертвования для оплаты счетов, например, нашего доменного имени, GitBook, Netlify и serverless-хостинга.
Если вы хотите поддержать, то ☕ [**купите чашку кофе**](https://buymeacoff.ee/fenny).
| | Пользователи | Пожертвования |
| :---------------------------------------------------------- | :---------------------------------------------- | :------- |
| ![](https://avatars.githubusercontent.com/u/59947262?s=25 ) | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/1094221?s=25 ) | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/186637?s=25 ) | [@candidosales](https://github.com/candidosales)| ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/635852?s=25 ) | [@bihe](https://github.com/bihe) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/307334?s=25 ) | [@justdave](https://github.com/justdave) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/11155743?s=25 ) | [@koddr](https://github.com/koddr) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/29042462?s=25 ) | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/2978730?s=25 ) | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/44171355?s=25 ) | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/5638101?s=25 ) | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/619996?s=25 ) | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31022056?s=25 ) | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31921460?s=25 ) | [@toishy](https://github.com/toishy) | ☕ x 1 |
## ‎‍💻 Контрибьютеры
<img src="https://opencollective.com/fiber/contributors.svg?width=890&button=false" alt="Code Contributors" style="max-width:100%;">
## ⚠️ License
Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) license (CC BY-SA 4.0 International).
**Third-party library licenses**
- [FastHTTP](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [Schema](https://github.com/gorilla/schema/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)

550
.github/README_tr.md vendored Normal file
View File

@ -0,0 +1,550 @@
<p align="center">
<a href="https://gofiber.io">
<img alt="Fiber" height="125" src="https://github.com/gofiber/docs/blob/master/static/fiber_v2_logo.svg">
</a>
<br>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/en.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ru.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ru.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_es.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/es.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ja.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/jp.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_pt.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/pt.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_zh-CN.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ch.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_fr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/fr.svg">
</a>
<!--<a href="https://github.com/gofiber/fiber/blob/master/.github/README_tr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/tr.svg">
</a>-->
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_id.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/id.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_he.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/il.svg">
</a>
<br><br>
<a href="https://github.com/gofiber/fiber/releases">
<img src="https://img.shields.io/github/release/gofiber/fiber?style=flat-square">
</a>
<a href="https://docs.gofiber.io">
<img src="https://img.shields.io/badge/api-docs-blue?style=flat-square">
</a>
<a href="https://pkg.go.dev/github.com/gofiber/fiber?tab=doc">
<img src="https://img.shields.io/badge/go.dev-007d9c?logo=go&logoColor=white&style=flat-square">
</a>
<a href="https://goreportcard.com/report/github.com/gofiber/fiber">
<img src="https://goreportcard.com/badge/github.com/gofiber/fiber?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ATest">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Test?label=tests&style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3AGosec">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Gosec?label=gosec&style=flat-square">
</a>
<a href="https://gofiber.io/discord">
<img src="https://img.shields.io/badge/discord-join%20channel-7289DA?style=flat-square">
</a>
</p>
<p align="center">
<b>Fiber</b>, <a href="https://golang.org/doc/">Go</a> için <b>en hızlı</b> HTTP motoru olan <a href="https://github.com/valyala/fasthttp">Fasthttp</a> üzerine inşa edilmiş, <a href="https://github.com/expressjs/express">Express</a> den ilham alan bir <b>web çatısıdır</b>. <b>Sıfır bellek ayırma</b> ve <b>performans</b> göz önünde bulundurularak <b>hızlı</b> geliştirme için işleri <b>kolaylaştırmak</b> üzere tasarlandı.
</p>
## ⚡️ Hızlı Başlangıç
```go
package main
import "github.com/gofiber/fiber"
func main() {
app := fiber.New()
app.Get("/", func(c *fiber.Ctx) {
c.Send("Merhaba dünya!")
})
app.Listen(3000)
}
```
## ⚙️ Kurulum
İlk önce, Go yu [indirip](https://golang.org/dl/) kuruyoruz. `1.11` veya daha yeni sürüm gereklidir.
[`go get`](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) komutunu kullanarak kurulumu tamamlıyoruz:
```bash
go get -u github.com/gofiber/fiber/...
```
## 🤖 Performans Ölçümleri
Bu testler [TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks) ve [Go Web](https://github.com/smallnest/go-web-framework-benchmark) ile koşuldu. Bütün sonuçları görmek için lütfen [Wiki](https://docs.gofiber.io/benchmarks) sayfasını ziyaret ediniz.
<p float="left" align="middle">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark-pipeline.png" width="49%">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets//benchmark_alloc.png" width="49%">
</p>
## 🎯 Özellikler
- Güçlü [rotalar](https://docs.gofiber.io/routing)
- [Statik dosya](https://docs.gofiber.io/application#static) yönetimi
- Olağanüstü [performans](https://docs.gofiber.io/benchmarks)
- [Düşük bellek](https://docs.gofiber.io/benchmarks) tüketimi
- [API uç noktaları](https://docs.gofiber.io/context)
- Ara katman & [Sonraki](https://docs.gofiber.io/context#next) desteği
- [Hızlı](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) sunucu taraflı programlama
- [Template engines](https://docs.gofiber.io/middleware#template)
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
- Available in [12 languages](https://docs.gofiber.io/)
- Ve daha fazlası, [Fiber ı keşfet](https://docs.gofiber.io/)
## 💡 Felsefe
[Node.js](https://nodejs.org/en/about/) den [Go](https://golang.org/doc/) ya geçen yeni gopher lar kendi web uygulamalarını ve mikroservislerini yazmaya başlamadan önce dili öğrenmek ile uğraşıyorlar. Fiber, bir **web çatısı** olarak, **minimalizm** ve **UNIX yolu**nu izlemek fikri ile oluşturuldu. Böylece yeni gopher lar sıcak ve güvenilir bir hoşgeldin ile Go dünyasına giriş yapabilirler.
Fiber internet üzerinde en popüler olan Express web çatısından **esinlenmiştir**. Biz Express in **kolaylığını** ve Go nun **ham performansını** birleştirdik. Daha önce Node.js üzerinde (Express veya benzerini kullanarak) bir web uygulaması geliştirdiyseniz, pek çok metod ve prensip size **çok tanıdık** gelecektir.
## 👀 Örnekler
Aşağıda yaygın örneklerden bazıları listelenmiştir. Daha fazla kod örneği görmek için, lütfen [Kod deposunu](https://github.com/gofiber/recipes) veya [API dökümantasyonunu](https://docs.gofiber.io) ziyaret ediniz.
### Rotalama
📖 [Rotalama](https://docs.gofiber.io/#basic-routing)
```go
func main() {
app := fiber.New()
// GET /john http methodunu çağır
app.Get("/:name", func(c *fiber.Ctx) {
fmt.Printf("Hello %s!", c.Params("name"))
// => Hello john!
})
// GET /john http methodunu çağır
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 http methodunu çağır
app.Get("/api/*", func(c *fiber.Ctx) {
fmt.Printf("/api/%s", c.Params("*"))
// => /api/register
})
app.Listen(3000)
}
```
### Statik Dosyaları Servis Etmek
📖 [Statik](https://docs.gofiber.io/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)
}
```
### Ara Katman ve İleri(Middleware & Next)
📖 [Ara Katman](https://docs.gofiber.io/routing#middleware)
📖 [İleri](https://docs.gofiber.io/context#next)
```go
func main() {
app := fiber.New()
// Bütün rotalarla eşleş
app.Use(func(c *fiber.Ctx) {
fmt.Println("First middleware")
c.Next()
})
// /api ile başlayan tüm rotalarla eşleş
app.Use("/api", func(c *fiber.Ctx) {
fmt.Println("Second middleware")
c.Next()
})
// GET /api/register http methodunu çağır
app.Get("/api/list", func(c *fiber.Ctx) {
fmt.Println("Last middleware")
c.Send("Hello, World!")
})
app.Listen(3000)
}
```
<details>
<summary>📚 Daha fazla kod örneği göster</summary>
### Şablon Motorları
📖 [Ayarlar](https://docs.gofiber.io/application#settings)
📖 [Tasvir et(Render)](https://docs.gofiber.io/context#render)
📖 [Şablonlar](https://docs.gofiber.io/middleware#template)
Fiber varsayılan olarak [Go şablon motoru](https://golang.org/pkg/html/template/)'nu destekler.
Eğer başka bir şablon motoru kullanmak isterseniz, mesela [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) yada [pug](https://github.com/Joker/jade) gibi, bizim [Şablon Ara Katmanımızı](https://docs.gofiber.io/middleware#template) da kullanabilirsiniz.
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/template"
)
func main() {
//Uygulamayı başlatmadan önce şablon motorunu kurabilirsiniz:
app := fiber.New(&fiber.Settings{
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})
// YADA uygulamayı başlattıktan sonra uygun yere koyabilirsiniz:
app.Settings.TemplateEngine = template.Mustache()
app.Settings.TemplateFolder = "./views"
app.Settings.TemplateExtension = ".tmpl"
// Ve şimdi, bu şekide `./views/home.tmpl` şablonunu çağırabilirsiniz:
app.Get("/", func(c *fiber.Ctx) {
c.Render("home", fiber.Map{
"title": "Homepage",
"year": 1999,
})
})
// ...
}
```
### Rotaları Zincirlere Gruplama
📖 [Grup](https://docs.gofiber.io/application#group)
```go
func main() {
app := fiber.New()
// Kök API rotası
api := app.Group("/api", cors()) // /api
// API v1 rotası
v1 := api.Group("/v1", mysql()) // /api/v1
v1.Get("/list", handler) // /api/v1/list
v1.Get("/user", handler) // /api/v1/user
// API v2 rotası
v2 := api.Group("/v2", mongodb()) // /api/v2
v2.Get("/list", handler) // /api/v2/list
v2.Get("/user", handler) // /api/v2/user
// ...
}
```
### Ara Katman Günlükcüsü(Logger)
📖 [Günlükcü](https://docs.gofiber.io/middleware#logger)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/logger"
)
func main() {
app := fiber.New()
// Tercihe bağlı günlük ayarları
config := logger.Config{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Günlükcüyü ayarla
app.Use(logger.New(config))
app.Listen(3000)
}
```
### Farklı Merkezler Arası Kaynak Paylaşımı (CORS)
📖 [CORS](https://docs.gofiber.io/middleware#cors)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/cors"
)
func main() {
app := fiber.New()
// Varsayılan ayarlarla CORS
app.Use(cors.New())
app.Listen(3000)
}
```
`Origin` başlığı içinde herhangı bir alan adı kullanarak CORS'u kontrol et:
```bash
curl -H "Origin: http://example.com" --verbose http://localhost:3000
```
### Özelleştirilebilir 404 yanıtları
📖 [HTTP Methodlari](https://docs.gofiber.io/application#http-methods)
```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!")
})
// Herhangi bir şeyle eşleşen son ara katman
app.Use(func(c *fiber.Ctx) {
c.SendStatus(404)
// => 404 "Not Found"
})
app.Listen(3000)
}
```
### JSON Yanıtları
📖 [JSON](https://docs.gofiber.io/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 Yükseltmesi
📖 [Websocket](https://docs.gofiber.io/middleware#websocket)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
app.Get("/ws", websocket.New(func(c *websocket.Conn) {
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
log.Printf("recv: %s", msg)
err = c.WriteMessage(mt, msg)
if err != nil {
log.Println("write:", err)
break
}
}
}))
app.Listen(3000)
// ws://localhost:3000/ws
}
```
### Ara Katman'dan Kurtarma
📖 [Kurtar](https://docs.gofiber.io/middleware#recover)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/recover"
)
func main() {
app := fiber.New()
// Özelleştirilebilir kurtarma ayarı
config := recover.Config{
Handler: func(c *fiber.Ctx, err error) {
c.SendString(err.Error())
c.SendStatus(500)
},
}
// Özelleştrilebilir günlükleme
app.Use(recover.New(config))
app.Listen(3000)
}
```
</details>
## 🧬 Official Middlewares
For an more _maintainable_ middleware _ecosystem_, we've put official [middlewares](https://docs.gofiber.io/middleware) into separate repositories:
- [gofiber/compression](https://github.com/gofiber/compression)
- [gofiber/basicauth](https://github.com/gofiber/basicauth)
- [gofiber/requestid](https://github.com/gofiber/requestid)
- [gofiber/websocket](https://github.com/gofiber/websocket)
- [gofiber/keyauth](https://github.com/gofiber/keyauth)
- [gofiber/rewrite](https://github.com/gofiber/rewrite)
- [gofiber/recover](https://github.com/gofiber/recover)
- [gofiber/limiter](https://github.com/gofiber/limiter)
- [gofiber/session](https://github.com/gofiber/session)
- [gofiber/adaptor](https://github.com/gofiber/adaptor)
- [gofiber/logger](https://github.com/gofiber/logger)
- [gofiber/helmet](https://github.com/gofiber/helmet)
- [gofiber/embed](https://github.com/gofiber/embed)
- [gofiber/pprof](https://github.com/gofiber/pprof)
- [gofiber/cors](https://github.com/gofiber/cors)
- [gofiber/csrf](https://github.com/gofiber/csrf)
- [gofiber/jwt](https://github.com/gofiber/jwt)
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
## 💬 Medya
- [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) — _03 Feb 2020_
- [Fiber released v1.7! 🎉 What's new and is it 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) — _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) — _03 Mar 2020_
- [Is switching from Express to Fiber worth it? 🤔](https://dev.to/koddr/are-sure-what-your-lovely-web-framework-running-so-fast-2jl1) — _01 Apr 2020_
- [Creating Fast APIs In Go Using Fiber](https://dev.to/jozsefsallai/creating-fast-apis-in-go-using-fiber-59m9) — _07 Apr 2020_
- [Building a Basic REST API in Go using Fiber](https://tutorialedge.net/golang/basic-rest-api-go-fiber/) - _23 Apr 2020_
- [📺 Building a REST API using GORM and Fiber](https://youtu.be/Iq2qT0fRhAA) - _25 Apr 2020_
- [🌎 Create a travel list app with Go, Fiber, Angular, MongoDB and Google Cloud Secret Manager](https://blog.yongweilun.me/create-a-travel-list-app-with-go-fiber-angular-mongodb-and-google-cloud-secret-manager-ck9fgxy0p061pcss1xt1ubu8t) - _25 Apr 2020_
- [Fiber v1.9.6 🔥 How to improve performance by 817% and stay fast, flexible and friendly?](https://dev.to/koddr/fiber-v1-9-5-how-to-improve-performance-by-817-and-stay-fast-flexible-and-friendly-2dp6) - _12 May 2020_
## 👍 Destek
Eğer **teşekkür etmek** ve/veya `Fiber`'in aktif geliştirilmesini desteklemek istiyorsanız:
1. Projeye [GitHub Yıldızı](https://github.com/gofiber/fiber/stargazers) verin.
2. [Twitter hesabınızdan](https://twitter.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber) proje hakkında tweet atın.
3. [Medium](https://medium.com/), [Dev.to](https://dev.to/) veya kişisel blog üzerinden bir inceleme veya eğitici yazı yazın.
4. API dökümantasyonunu çevirerek destek olabilirsiniz [Crowdin](https://crowdin.com/project/gofiber) [![Crowdin](https://badges.crowdin.net/gofiber/localized.svg)](https://crowdin.com/project/gofiber)
5. Projeye [bir fincan kahve] ısmarlayarak projeye destek olabilirsiniz(https://buymeacoff.ee/fenny).
## ☕ Destekçiler
Fiber, alan adı, gitbook, netlify, serverless yer sağlayıcısı giderleri ve benzeri şeyleri ödemek için bağışlarla yaşayan bir açık kaynaklı projedir. Eğer Fiber'e destek olmak isterseniz, ☕ [**buradan kahve ısmarlayabilirsiniz.**](https://buymeacoff.ee/fenny)
| | User | Donation |
| :---------------------------------------------------------- | :---------------------------------------------- | :------- |
| ![](https://avatars.githubusercontent.com/u/59947262?s=25 ) | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/1094221?s=25 ) | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/186637?s=25 ) | [@candidosales](https://github.com/candidosales)| ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/635852?s=25 ) | [@bihe](https://github.com/bihe) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/307334?s=25 ) | [@justdave](https://github.com/justdave) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/11155743?s=25 ) | [@koddr](https://github.com/koddr) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/29042462?s=25 ) | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/2978730?s=25 ) | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/44171355?s=25 ) | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/5638101?s=25 ) | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/619996?s=25 ) | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31022056?s=25 ) | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31921460?s=25 ) | [@toishy](https://github.com/toishy) | ☕ x 1 |
## ‎‍💻 Koda Katkı Sağlayanlar
<img src="https://opencollective.com/fiber/contributors.svg?width=890&button=false" alt="Code Contributors" style="max-width:100%;">
## ⚠️ Lisans
Telif (c) 2019-günümüz [Fenny](https://github.com/fenny) ve [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber`, [MIT Lisansı](https://github.com/gofiber/fiber/blob/master/LICENSE) altında özgür ve açık kaynaklı bir yazılımdır. Resmi logosu [Vic Shóstak](https://github.com/koddr) tarafında tasarlanmıştır ve [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) lisansı altında dağıtımı yapılır. (CC BY-SA 4.0 International).
**3. Parti yazılım lisanları**
- [FastHTTP](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [Schema](https://github.com/gorilla/schema/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)

555
.github/README_zh-CN.md vendored Normal file
View File

@ -0,0 +1,555 @@
<p align="center">
<a href="https://gofiber.io">
<img alt="Fiber" height="125" src="https://github.com/gofiber/docs/blob/master/static/fiber_v2_logo.svg">
</a>
<br>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/en.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ru.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ru.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_es.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/es.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ja.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/jp.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_pt.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/pt.svg">
</a>
<!--<a href="https://github.com/gofiber/fiber/blob/master/.github/README_zh-CN.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ch.svg">
</a>-->
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_fr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/fr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_tr.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/tr.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_id.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/id.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_he.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/il.svg">
</a>
<br><br>
<a href="https://github.com/gofiber/fiber/releases">
<img src="https://img.shields.io/github/release/gofiber/fiber?style=flat-square">
</a>
<a href="https://docs.gofiber.io">
<img src="https://img.shields.io/badge/api-docs-blue?style=flat-square">
</a>
<a href="https://pkg.go.dev/github.com/gofiber/fiber?tab=doc">
<img src="https://img.shields.io/badge/go.dev-007d9c?logo=go&logoColor=white&style=flat-square">
</a>
<a href="https://goreportcard.com/report/github.com/gofiber/fiber">
<img src="https://goreportcard.com/badge/github.com/gofiber/fiber?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ATest">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Test?label=tests&style=flat-square">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3AGosec">
<img src="https://img.shields.io/github/workflow/status/gofiber/fiber/Gosec?label=gosec&style=flat-square">
</a>
<a href="https://gofiber.io/discord">
<img src="https://img.shields.io/badge/discord-join%20channel-7289DA?style=flat-square">
</a>
</p>
<p align="center">
<b>Fiber</b>是一个基于<a href="https://github.com/expressjs/express">Express的</a> <b>Web框架</b>,建立在<a href="https://golang.org/doc/">Go</a>语言写的 <b>最快的</b><a href="https://github.com/valyala/fasthttp">Fasthttp</a>HTTP引擎的基础上。皆在</b>简化</b> <b>零内存分配</b><b>提高性能</b>,以便<b>快速</b>开发。
</p>
## ⚡️ 快速入门
```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)
}
```
## ⚙️ 安装
首先, [下载](https://golang.org/dl/)并安装Go。 `1.11`或更高。
使用[`go get`](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them)命令完成安装:
```bash
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
go get -u github.com/gofiber/fiber
```
## 🤖 性能
这些测试由[TechEmpower](https://github.com/TechEmpower/FrameworkBenchmarks)和[Go Web执行](https://github.com/smallnest/go-web-framework-benchmark) 。如果要查看所有结果,请访问我们的[Wiki](https://docs.gofiber.io/benchmarks) 。
<p float="left" align="middle">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets/benchmark-pipeline.png" width="49%">
<img src="https://github.com/gofiber/docs/blob/master/.gitbook/assets/benchmark_alloc.png" width="49%">
</p>
## 🎯 特点
- 强大的[路由](https://docs.gofiber.io/routing)
- [静态文件](https://docs.gofiber.io/application#static)服务
- 极限[表现](https://docs.gofiber.io/benchmarks)
- [内存占用低](https://docs.gofiber.io/benchmarks)
- Express [API端点](https://docs.gofiber.io/context)
- 中间件和[Next](https://docs.gofiber.io/context#next)支持
- [快速的](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497)服务器端编程
- [Template engines](https://docs.gofiber.io/middleware#template)
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
- Available in [12 languages](https://docs.gofiber.io/)
- 以及更多[文档](https://docs.gofiber.io/)
## 💡 哲学
从[Node.js](https://nodejs.org/en/about/)切换到[Go的](https://golang.org/doc/)新gopher在开始构建Web应用程序或微服务之前正在应对学习过程。 Fiber作为一个**Web框架** ,是按照**极简主义**的思想并遵循**UNIX方式创建的**因此新的gopher可以以热烈和可信赖的欢迎**方式**迅速进入Go的世界。
Fiber **受** Internet上最流行的Web框架Expressjs的**启发** 。我们结合了Express的**易用**性和Go的**原始性能** 。如果您曾经在Node.js上实现过Web应用程序(*使用Express.js或类似工具*),那么许多方法和原理对您来说似乎**非常易懂**。
## 👀 示例
下面列出了一些常见示例。如果您想查看更多代码示例,请访问我们的[Recipes存储库](https://github.com/gofiber/recipes)或访问我们的[API文档](https://docs.gofiber.io) 。
### Routing
📖 [Routing](https://docs.gofiber.io/#basic-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
📖 [Static](https://docs.gofiber.io/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
📖 [Middleware](https://docs.gofiber.io/routing#middleware)
📖 [Next](https://docs.gofiber.io/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()
})
// GET /api/register
app.Get("/api/list", func(c *fiber.Ctx) {
fmt.Println("Last middleware")
c.Send("Hello, World!")
})
app.Listen(3000)
}
```
<details>
<summary>📚 Show more code examples</summary>
### Template engines
📖 [Settings](https://docs.gofiber.io/application#settings)
📖 [Render](https://docs.gofiber.io/context#render)
📖 [Template](https://docs.gofiber.io/middleware#template)
Fiber supports the default [Go template engine](https://golang.org/pkg/html/template/)
But if you want to use another template engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade).
You can use our [Template Middleware](https://docs.gofiber.io/middleware#template).
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/template"
)
func main() {
// You can setup template engine before initiation app:
app := fiber.New(&fiber.Settings{
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})
// OR after initiation app at any convenient location:
app.Settings.TemplateEngine = template.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
📖 [Group](https://docs.gofiber.io/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
📖 [Logger](https://docs.gofiber.io/middleware#logger)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/logger"
)
func main() {
app := fiber.New()
// Optional logger config
config := logger.Config{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Logger with config
app.Use(logger.New(config))
app.Listen(3000)
}
```
### Cross-Origin Resource Sharing (CORS)
📖 [CORS](https://docs.gofiber.io/middleware#cors)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/cors"
)
func main() {
app := fiber.New()
// CORS with default config
app.Use(cors.New())
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
📖 [HTTP Methods](https://docs.gofiber.io/application#http-methods)
```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
📖 [JSON](https://docs.gofiber.io/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 Upgrade
📖 [Websocket](https://docs.gofiber.io/middleware#websocket)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
app.Get("/ws", websocket.New(func(c *websocket.Conn) {
for {
mt, msg, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
log.Printf("recv: %s", msg)
err = c.WriteMessage(mt, msg)
if err != nil {
log.Println("write:", err)
break
}
}
}))
app.Listen(3000)
// ws://localhost:3000/ws
}
```
### Recover middleware
📖 [Recover](https://docs.gofiber.io/middleware#recover)
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/recover"
)
func main() {
app := fiber.New()
// Optional recover config
config := recover.Config{
Handler: func(c *fiber.Ctx, err error) {
c.SendString(err.Error())
c.SendStatus(500)
},
}
// Logger with custom config
app.Use(recover.New(config))
app.Listen(3000)
}
```
</details>
## 🧬 Official Middlewares
For an more _maintainable_ middleware _ecosystem_, we've put official [middlewares](https://docs.gofiber.io/middleware) into separate repositories:
- [gofiber/compression](https://github.com/gofiber/compression)
- [gofiber/basicauth](https://github.com/gofiber/basicauth)
- [gofiber/requestid](https://github.com/gofiber/requestid)
- [gofiber/websocket](https://github.com/gofiber/websocket)
- [gofiber/keyauth](https://github.com/gofiber/keyauth)
- [gofiber/rewrite](https://github.com/gofiber/rewrite)
- [gofiber/recover](https://github.com/gofiber/recover)
- [gofiber/limiter](https://github.com/gofiber/limiter)
- [gofiber/session](https://github.com/gofiber/session)
- [gofiber/adaptor](https://github.com/gofiber/adaptor)
- [gofiber/logger](https://github.com/gofiber/logger)
- [gofiber/helmet](https://github.com/gofiber/helmet)
- [gofiber/embed](https://github.com/gofiber/embed)
- [gofiber/pprof](https://github.com/gofiber/pprof)
- [gofiber/cors](https://github.com/gofiber/cors)
- [gofiber/csrf](https://github.com/gofiber/csrf)
- [gofiber/jwt](https://github.com/gofiber/jwt)
## 🌱 Third Party Middlewares
This is a list of middlewares that are created by the Fiber community, please create a PR if you want to see yours!
- [arsmn/fiber-swagger](https://github.com/arsmn/fiber-swagger)
- [arsmn/fiber-casbin](https://github.com/arsmn/fiber-casbin)
- [arsmn/fiber-introspect](https://github.com/arsmn/fiber-introspect)
- [shareed2k/fiber_tracing](https://github.com/shareed2k/fiber_tracing)
- [shareed2k/fiber_limiter](https://github.com/shareed2k/fiber_limiter)
- [thomasvvugt/fiber-boilerplate](https://github.com/thomasvvugt/fiber-boilerplate)
- [arsmn/gqlgen](https://github.com/arsmn/gqlgen)
## 💬 媒体
- [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) — _03 Feb 2020_
- [Fiber released v1.7! 🎉 What's new and is it 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) — _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) — _03 Mar 2020_
- [Is switching from Express to Fiber worth it? 🤔](https://dev.to/koddr/are-sure-what-your-lovely-web-framework-running-so-fast-2jl1) — _01 Apr 2020_
- [Creating Fast APIs In Go Using Fiber](https://dev.to/jozsefsallai/creating-fast-apis-in-go-using-fiber-59m9) — _07 Apr 2020_
- [Building a Basic REST API in Go using Fiber](https://tutorialedge.net/golang/basic-rest-api-go-fiber/) - _23 Apr 2020_
- [📺 Building a REST API using GORM and Fiber](https://youtu.be/Iq2qT0fRhAA) - _25 Apr 2020_
- [🌎 Create a travel list app with Go, Fiber, Angular, MongoDB and Google Cloud Secret Manager](https://blog.yongweilun.me/create-a-travel-list-app-with-go-fiber-angular-mongodb-and-google-cloud-secret-manager-ck9fgxy0p061pcss1xt1ubu8t) - _25 Apr 2020_
- [Fiber v1.9.6 🔥 How to improve performance by 817% and stay fast, flexible and friendly?](https://dev.to/koddr/fiber-v1-9-5-how-to-improve-performance-by-817-and-stay-fast-flexible-and-friendly-2dp6) - _12 May 2020_
## 👍 贡献
如果您要说声**谢谢**或支持`Fiber`的积极发展:
1. 将[GitHub Star](https://github.com/gofiber/fiber/stargazers)添加到项目中。
2. [在Twitter上](https://twitter.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber)发布有关项目[的推文](https://twitter.com/intent/tweet?text=Fiber%20is%20an%20Express%20inspired%20%23web%20%23framework%20built%20on%20top%20of%20Fasthttp%2C%20the%20fastest%20HTTP%20engine%20for%20%23Go.%20Designed%20to%20ease%20things%20up%20for%20%23fast%20development%20with%20zero%20memory%20allocation%20and%20%23performance%20in%20mind%20%F0%9F%9A%80%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber)。
3. 在[Medium](https://medium.com/)[Dev.to](https://dev.to/)或个人博客上写评论或教程。
4. Help us to translate our API Documentation via [Crowdin](https://crowdin.com/project/gofiber) [![Crowdin](https://badges.crowdin.net/gofiber/localized.svg)](https://crowdin.com/project/gofiber)
5. Support the project by donating a [cup of coffee](https://buymeacoff.ee/fenny).
## ☕ Supporters
Fiber is an open source project that runs on donations to pay the bills e.g. our domain name, gitbook, netlify and serverless hosting. If you want to support Fiber, you can ☕ [**buy a coffee here**](https://buymeacoff.ee/fenny)
| | User | Donation |
| :---------------------------------------------------------- | :---------------------------------------------- | :------- |
| ![](https://avatars.githubusercontent.com/u/59947262?s=25 ) | [@thomasvvugt](https://github.com/thomasvvugt) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/1094221?s=25 ) | [@ekaputra07](https://github.com/ekaputra07) | ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/186637?s=25 ) | [@candidosales](https://github.com/candidosales)| ☕ x 5 |
| ![](https://avatars.githubusercontent.com/u/635852?s=25 ) | [@bihe](https://github.com/bihe) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/307334?s=25 ) | [@justdave](https://github.com/justdave) | ☕ x 3 |
| ![](https://avatars.githubusercontent.com/u/11155743?s=25 ) | [@koddr](https://github.com/koddr) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/29042462?s=25 ) | [@lapolinar](https://github.com/lapolinar) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/2978730?s=25 ) | [@diegowifi](https://github.com/diegowifi) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/44171355?s=25 ) | [@ssimk0](https://github.com/ssimk0) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/5638101?s=25 ) | [@raymayemir](https://github.com/raymayemir) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/619996?s=25 ) | [@melkorm](https://github.com/melkorm) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31022056?s=25 ) | [@marvinjwendt](https://github.com/thomasvvugt) | ☕ x 1 |
| ![](https://avatars.githubusercontent.com/u/31921460?s=25 ) | [@toishy](https://github.com/toishy) | ☕ x 1 |
## ‎‍💻 Code Contributors
<img src="https://opencollective.com/fiber/contributors.svg?width=890&button=false" alt="Code Contributors" style="max-width:100%;">
## ⚠️ License
Copyright (c) 2019-present [Fenny](https://github.com/fenny) and [Contributors](https://github.com/gofiber/fiber/graphs/contributors). `Fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/blob/master/LICENSE). Official logo was created by [Vic Shóstak](https://github.com/koddr) and distributed under [Creative Commons](https://creativecommons.org/licenses/by-sa/4.0/) license (CC BY-SA 4.0 International).
**Third-party library licenses**
- [FastHTTP](https://github.com/valyala/fasthttp/blob/master/LICENSE)
- [Schema](https://github.com/gorilla/schema/blob/master/LICENSE)
- [bytebufferpool](https://github.com/valyala/bytebufferpool/blob/master/LICENSE)

11
.github/auto-assign-issues.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# If enabled, auto-assigns users when a new issue is created
# Defaults to true, allows you to install the app globally, and disable on a per-repo basis
addAssignees: true
# The list of users to assign to new issues.
# If empty or not provided, the repository owner is assigned
assignees:
- fenny
- koddr
- thomasvvugt
- jozsefsallai

20
.github/auto_assign.yml vendored Normal file
View File

@ -0,0 +1,20 @@
# Set to true to add reviewers to pull requests
addReviewers: true
# Set to true to add assignees to pull requests
addAssignees: true
# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
- fenny
- koddr
- thomasvvugt
- jozsefsallai
# A list of keywords to be skipped the process that add reviewers if pull requests include it
skipKeywords:
- wip
# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 0

17
.github/config.yml vendored Normal file
View File

@ -0,0 +1,17 @@
# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
# Comment to be posted to on first time issues
newIssueWelcomeComment: >
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template!
If you need help or want to chat with us, join us on Discord https://gofiber.io/discord
# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
# Comment to be posted to on PRs from first time contributors in your repository
newPRWelcomeComment: >
Thanks for opening this pull request! 🎉 Please check out our contributing guidelines.
If you need help or want to chat with us, join us on Discord https://gofiber.io/discord
# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
# Comment to be posted to on pull requests merged by a first time user
firstPRMergeComment: >
Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you!
If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

26
.github/stale.yml vendored Normal file
View File

@ -0,0 +1,26 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
👋 Hello. Is this still relevant? If so, what is blocking it? Is there
anything you can do to help move it forward?
> This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Thank you for your contributions.
# Comment to post when closing a stale Issue or Pull Request. Set to `false` to disable
closeComment: >
⚡️ This issue has been automatically closed because it has not had recent activity.

28
.github/workflows/benchmark.yml vendored Normal file
View File

@ -0,0 +1,28 @@
on: [push, pull_request]
name: Benchmark
jobs:
Compare:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Fetch Repository
uses: actions/checkout@v2
- name: Run Benchmark
run: go test -benchmem -run=^$ -bench . | tee output.txt
- name: Get Previous Benchmark Results
uses: actions/cache@v1
with:
path: ./cache
key: ${{ runner.os }}-benchmark
- name: Save Benchmark Results
uses: rhysd/github-action-benchmark@v1
with:
tool: 'go'
auto-push: true
fail-on-alert: true
comment-on-alert: true
output-file-path: output.txt
github-token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}

10
.github/workflows/linter.yml vendored Normal file
View File

@ -0,0 +1,10 @@
on: [push, pull_request]
name: Linter
jobs:
Golint:
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
uses: actions/checkout@v2
- name: Run Golint
uses: actions-contrib/golangci-lint@v1

12
.github/workflows/security.yml vendored Normal file
View File

@ -0,0 +1,12 @@
on: [push, pull_request]
name: Security
jobs:
Gosec:
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
uses: actions/checkout@v2
- name: Run Gosec
uses: securego/gosec@master
with:
args: ./...

18
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,18 @@
on: [push, pull_request]
name: Test
jobs:
Build:
strategy:
matrix:
go-version: [1.11.x, 1.14.x]
platform: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Fetch Repository
uses: actions/checkout@v2
- name: Run Test
run: go test -v -race