Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring, translate to Russian, add CORS middleware #4

Merged
merged 17 commits into from Feb 3, 2020
8 changes: 8 additions & 0 deletions .github/FUNDING.yml
@@ -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: # Replace with a single custom sponsorship URL
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,40 @@
---
name: Bug report
about: Create a report to help us improve
title: "[馃悶] "
labels: ""
assignees: ""
---

鈽濓笍 **Don't forget to add title above!** 鈽濓笍

**Your environment:**

- Fiber Web Framework [e.g. `1.2.3`]:
- OS [e.g. `macOS 10.14.6`]:
- Golang [e.g. `1.13.7`]:

## Describe the bug

A clear and concise description of what the bug is.

## To reproduce

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.
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,21 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[馃敟] "
labels: ""
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 [...]

**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.
14 changes: 14 additions & 0 deletions .github/config.yml
@@ -0,0 +1,14 @@
# 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!

# 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.

# 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 behaviorbot are proud of you!
26 changes: 26 additions & 0 deletions .github/stale.yml
@@ -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.
118 changes: 80 additions & 38 deletions README.md
@@ -1,113 +1,155 @@
<p align="center">
<img height="150" src="https://gofiber.github.io/fiber/static/logo.jpg">
</p>
<!--
![](https://img.shields.io/github/issues/gofiber/fiber)
![](https://img.shields.io/github/stars/gofiber/fiber)
-->
# 馃攲 Fiber Web Framework

# Fiber [![](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)
[![](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)

**[Fiber](https://github.com/gofiber/fiber)** is an **[Express](https://expressjs.com/en/4x/api.html)** styled HTTP framework implementation running on **[Fasthttp](https://github.com/valyala/fasthttp)**, the **fastest** HTTP engine for **[Go](https://golang.org/doc/)**. The package make use of similar framework convention as they are in express. People switching from **[Node](https://nodejs.org/en/about/)** to **[Go](https://golang.org/doc/)** often end up in a bad learning curve to start building their webapps, this project is meant to **ease** things up for **fast** development, but with **zero memory allocation** and **performance** in mind. See **[API Documentation](https://gofiber.github.io/fiber/)**
<img align="right" height="180px" src="docs/static/logo_320px_trans.png" alt="Fiber logo" />

**[Fiber](https://github.com/gofiber/fiber)** is an [Express](https://expressjs.com/en/4x/api.html)-styled HTTP web framework implementation running on [Fasthttp](https://github.com/valyala/fasthttp), the **fastest** HTTP engine for Go (Golang). The package make use of **similar framework convention** as they are in Express.

People switching from [Node.js](https://nodejs.org/en/about/) to [Go](https://golang.org/doc/) often end up in a bad learning curve to start building their webapps, this project is meant to **ease** things up for **fast** development, but with **zero memory allocation** and **performance** in mind.

**In other languages:** <a href="README_RU.md"><img width="20px" src="docs/static/flags/ru.svg" alt="ru"/></a>

## API Documentation

馃摎 We created an extended API documentation (_including examples_), **[click here](https://gofiber.github.io/fiber/)**.

## Benchmark

[![](https://gofiber.github.io/fiber/static/benchmarks/benchmark.png)](https://gofiber.github.io/fiber/#/benchmarks)
**[Click here to see all benchmark results](https://gofiber.github.io/fiber/#/benchmarks)**

馃憠 **[Click here](https://gofiber.github.io/fiber/#/benchmarks)** to see all benchmark results.

## Features
* Optimized for speed and low memory usage.
* Rapid Server-Side Programming
* Easy routing with parameters
* Static files with custom prefix
* Middleware with Next support
* Express API endpoints
* **[API Documentation](https://gofiber.github.io/fiber/)**

- Optimized for speed and low memory usage
- Rapid Server-Side Programming
- Easy routing with parameters
- Static files with custom prefix
- Middleware with Next support
- Express API endpoints
- [Extended documentation](https://gofiber.github.io/fiber/)

## Installing
Assuming you鈥檝e already installed **[Go](https://golang.org/doc/)**, install the **[Fiber](https://github.com/gofiber/fiber)** package by calling the following command:
```bash
$ go get -u github.com/gofiber/fiber
```

## Hello world
Embedded below is essentially the simplest Fiber app you can create.
```bash
$ create server.go
Assuming you鈥檝e already installed Go `1.11+` 馃槈

Install the [Fiber](https://github.com/gofiber/fiber) package by calling the following command:

```console
go get -u github.com/gofiber/fiber
```

## Hello, world!

Embedded below is essentially the simplest Fiber app you can create:

```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

Go to console and run:

```console
go run server.go
```
Browse to **http://localhost:8080** and you should see `Hello, World!` on the page.

And now, browse to `http://localhost:8080` and you should see `Hello, World!` on the page! 馃帀

## Static files
To serve static files, use the [Static](https://gofiber.github.io/fiber/#/?id=static-files) method.

To serve static files, use the [Static](https://gofiber.github.io/fiber/#/?id=static-files) method:

```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)
}
```

Now, you can load the files that are in the public directory:
```shell

```console
http://localhost:8080/hello.html
http://localhost:8080/js/jquery.js
http://localhost:8080/js/script.js
http://localhost:8080/css/style.css
```

## Middleware
Middleware has never been so easy, just like express you call the Next() matching route function!

Middleware has never been so easy! Just like Express you call the `Next()` matching route function:

```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)
}
```

## API Documentation
We created an extended API documentation including examples, **[click here](https://gofiber.github.io/fiber/)**
## Project assistance

## License
gofiber/fiber is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/edit/master/LICENSE).
If you want to say 芦thank you禄 or/and support active development `gofiber/fiber`:

1. Add a GitHub Star to project.
2. Twit about project [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. Help us to translate this `README` and [API Docs](https://gofiber.github.io/fiber/) to another language.

Thanks for your support! 馃槝 Together, we make `Fiber Web Framework` better every day.

## Stargazers over time

[![Stargazers over time](https://starchart.cc/gofiber/fiber.svg)](https://starchart.cc/gofiber/fiber)

## License

*Caught a mistake? [Edit this page on GitHub!](https://github.com/gofiber/fiber/blob/master/README.md)*
鈿狅笍 _Please note:_ `gofiber/fiber` is free and open-source software licensed under the [MIT License](https://github.com/gofiber/fiber/edit/master/LICENSE).