-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from gofiber/master
Update fork from source
- Loading branch information
Showing
60 changed files
with
762 additions
and
2,310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,24 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: "[🐞] " | ||
labels: "" | ||
title: "🐞 " | ||
labels: bug | ||
assignees: "" | ||
--- | ||
**Fiber version/commit** | ||
|
||
☝️ **Don't forget to add title above!** ☝️ | ||
**Issue description** | ||
|
||
**Your environment:** | ||
**Expected behavior** | ||
|
||
- Fiber Web Framework [e.g. `1.2.3`]: | ||
- OS [e.g. `macOS 10.14.6`]: | ||
- Golang [e.g. `1.13.7`]: | ||
**Steps to reproduce** | ||
|
||
## Describe the bug | ||
**Code snippet** | ||
|
||
A clear and concise description of what the bug is. | ||
```go | ||
package main | ||
|
||
## To reproduce | ||
func main() { | ||
|
||
Steps to reproduce the behavior: | ||
|
||
1. Create func '...' | ||
2. Run '...' | ||
3. ... | ||
4. See error | ||
|
||
## Expected behavior | ||
|
||
A clear and concise description of what you expected to happen. | ||
|
||
### Screenshots | ||
|
||
If applicable, add screenshots to help explain your problem. | ||
|
||
### Additional context | ||
|
||
Add any other context about the problem here. | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: "[🔥] " | ||
labels: "" | ||
title: "🔥 " | ||
labels: enhancement | ||
assignees: "" | ||
--- | ||
|
||
☝️ **Don't forget to add title above!** ☝️ | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
**Is your feature request related to a problem?** | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
name: Question | ||
about: Ask a question so we can help | ||
title: "🤔 " | ||
labels: question | ||
assignees: "" | ||
--- | ||
**Question description** | ||
|
||
**Code snippet (optional)** | ||
|
||
```go | ||
package main | ||
|
||
func main() { | ||
|
||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Go | ||
on: [push] | ||
jobs: | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get dependencies | ||
run: | | ||
go get -v -t -d ./... | ||
if [ -f Gopkg.toml ]; then | ||
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | ||
dep ensure | ||
fi | ||
- name: Build | ||
run: go build -v . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
language: go | ||
go: | ||
- 1.13.x | ||
env: | ||
- GO111MODULE=on | ||
install: | ||
- go get -v golang.org/x/lint/golint | ||
script: | ||
# - golint -set_exit_status ./... | ||
- go test -race ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,153 @@ | ||
# 🔌 Fiber Web Framework | ||
# 🚀 Fiber <a href="README.md"><img width="20px" src="docs/static/flags/en.svg" alt="en"/></a> <a href="README_RU.md"><img width="20px" src="docs/static/flags/ru.svg" alt="ru"/></a> | ||
|
||
[![](https://img.shields.io/github/release/gofiber/fiber)](https://github.com/gofiber/fiber/releases) ![](https://img.shields.io/github/languages/top/gofiber/fiber) [![](https://godoc.org/github.com/gofiber/fiber?status.svg)](https://godoc.org/github.com/gofiber/fiber) ![](https://goreportcard.com/badge/github.com/gofiber/fiber) [![GitHub license](https://img.shields.io/github/license/gofiber/fiber.svg)](https://github.com/gofiber/fiber/blob/master/LICENSE) [![Join the chat at https://gitter.im/FiberGo/community](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/FiberGo/community) | ||
[![](https://img.shields.io/github/release/gofiber/fiber)](https://github.com/gofiber/fiber/releases) ![](https://img.shields.io/github/languages/top/gofiber/fiber) [![](https://godoc.org/github.com/gofiber/fiber?status.svg)](https://godoc.org/github.com/gofiber/fiber) ![](https://goreportcard.com/badge/github.com/gofiber/fiber) [![GitHub license](https://img.shields.io/github/license/gofiber/fiber.svg)](https://github.com/gofiber/fiber/blob/master/LICENSE) [![Join the chat at https://gitter.im/gofiber/community](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gofiber/community) | ||
|
||
<img align="right" height="180px" src="docs/static/logo_320px_trans.png" alt="Fiber logo" /> | ||
|
||
Help us to translate [this README](https://github.com/gofiber/fiber/blob/master/README_CH.md) in chinese. | ||
**[Fiber](https://github.com/gofiber/fiber)** 是一个 [Express.js](https://expressjs.com/en/4x/api.html) 运行的样式化HTTP Web框架实现 [Fasthttp](https://github.com/valyala/fasthttp), **最快的** HTTP引擎 Go (Golang). 该软件包使用了**相似的框架约定** Express. | ||
|
||
人们从 [Node.js](https://nodejs.org/en/about/) 至 [Go](https://golang.org/doc/) 通常会遇到学习曲线不好的问题,从而开始构建他们的Web应用程序, 这个项目是为了 **缓解** 事情准备 **快速** 发展,但与 **零内存分配** 和 **性能** 心里. | ||
|
||
## API Documentation | ||
|
||
📚 我们创建了一个扩展我们创建了一个扩展 **API documentation** (_包括例子_), **[点击这里](https://fiber.wiki/)**. | ||
|
||
## Benchmark | ||
|
||
[![](https://fiber.wiki/static/benchmarks/benchmark.png)](https://fiber.wiki/#/benchmarks) | ||
|
||
👉 **[点击这里](https://fiber.wiki/#/benchmarks)** 查看所有基准测试结果. | ||
|
||
## Features | ||
|
||
- 针对速度和低内存使用进行了优化 | ||
- 快速的服务器端编程 | ||
- 通过参数轻松路由 | ||
- 具有自定义前缀的静态文件 | ||
- 具有Next支持的中间件 | ||
- Express API端点 | ||
- [Extended documentation](https://fiber.wiki/) | ||
|
||
## Installing | ||
|
||
假设您已经安装 Go `1.11+` 😉 | ||
|
||
安装 [Fiber](https://github.com/gofiber/fiber) 通过调用以下命令来打包: | ||
|
||
```bash | ||
go get -u github.com/gofiber/fiber | ||
``` | ||
|
||
## Hello, world! | ||
|
||
本质上,下面嵌入是您可以创建的最简单的Fiber应用程序: | ||
|
||
```go | ||
// server.go | ||
|
||
package main | ||
|
||
import "github.com/gofiber/fiber" | ||
|
||
func main() { | ||
// Create new Fiber instance | ||
app := fiber.New() | ||
|
||
// Create new route with GET method | ||
app.Get("/", func(c *fiber.Ctx) { | ||
c.Send("Hello, World!") | ||
}) | ||
|
||
// Start server on http://localhost:8080 | ||
app.Listen(8080) | ||
} | ||
``` | ||
|
||
转到控制台并运行: | ||
|
||
```bash | ||
go run server.go | ||
``` | ||
|
||
现在,浏览至 `http://localhost:8080` 你应该看到 `Hello, World!` 在页面上! 🎉 | ||
|
||
## Static files | ||
|
||
要提供静态文件,请使用 [Static](https://fiber.wiki/#/?id=static-files) 方法: | ||
|
||
```go | ||
package main | ||
|
||
import "github.com/gofiber/fiber" | ||
|
||
func main() { | ||
// Create new Fiber instance | ||
app := fiber.New() | ||
|
||
// Serve all static files on ./public folder | ||
app.Static("./public") | ||
|
||
// Start server on http://localhost:8080 | ||
app.Listen(8080) | ||
} | ||
``` | ||
|
||
现在,您可以加载公共目录中的文件: | ||
|
||
```bash | ||
http://localhost:8080/hello.html | ||
http://localhost:8080/js/script.js | ||
http://localhost:8080/css/style.css | ||
``` | ||
|
||
## Middleware | ||
|
||
中间件从未如此简单!就像Express,您致电 `Next()` 匹配路线功能: | ||
|
||
```go | ||
package main | ||
|
||
import "github.com/gofiber/fiber" | ||
|
||
func main() { | ||
// Create new Fiber instance | ||
app := fiber.New() | ||
|
||
// Define all used middlewares in Use() | ||
|
||
app.Use(func(c *fiber.Ctx) { | ||
c.Write("Match anything!\n") | ||
c.Next() | ||
}) | ||
|
||
app.Use("/api", func(c *fiber.Ctx) { | ||
c.Write("Match starting with /api\n") | ||
c.Next() | ||
}) | ||
|
||
app.Get("/api/user", func(c *fiber.Ctx) { | ||
c.Write("Match exact path /api/user\n") | ||
}) | ||
|
||
// Start server on http://localhost:8080 | ||
app.Listen(8080) | ||
} | ||
``` | ||
|
||
## Project assistance | ||
|
||
如果您要说声谢谢或/并且支持积极的发展 `gofiber/fiber`: | ||
|
||
1. 将GitHub Star添加到项目中。 | ||
2. 关于项目的推文 [on your Twitter](https://twitter.com/intent/tweet?text=%F0%9F%94%8C%20Fiber%20is%20an%20Express.js%20inspired%20Go%20web%20framework%20build%20on%20%F0%9F%9A%80%20Fasthttp%20https%3A%2F%2Fgithub.com%2Fgofiber%2Ffiber). | ||
3. 帮助我们翻译 `README` 和 [API Docs](https://fiber.wiki/) 换一种语言. | ||
|
||
谢谢你的支持! 😘 我们在一起 `Fiber Web Framework` 每天都好. | ||
|
||
## Stargazers over time | ||
|
||
[![Stargazers over time](https://starchart.cc/gofiber/fiber.svg)](https://starchart.cc/gofiber/fiber) | ||
|
||
## License | ||
|
||
⚠️ _Please note:_ `gofiber/fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/edit/master/LICENSE). | ||
⚠️ _请注意:_ `gofiber/fiber` 是根据以下条款获得许可的免费开源软件 [MIT License](https://github.com/gofiber/fiber/edit/master/LICENSE). |
Oops, something went wrong.