Skip to content

Commit

Permalink
Merge pull request #240 from Fenny/master
Browse files Browse the repository at this point in the history
Update docs
  • Loading branch information
Fenny authored Mar 23, 2020
2 parents 16e48bb + b3a67c2 commit 9f2b087
Show file tree
Hide file tree
Showing 11 changed files with 425 additions and 674 deletions.
101 changes: 32 additions & 69 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,8 @@ Listed below are some of the common examples.
### Routing

Docs:
📖 https://fiber.wiki/#basic-routing

- 📖 https://fiber.wiki/#basic-routing

Example:

```go
func main() {
Expand Down Expand Up @@ -165,11 +162,7 @@ func main() {

### Serve static files

Docs:

- 📖 https://fiber.wiki/application#static

Example:
📖 https://fiber.wiki/application#static

```go
func main() {
Expand All @@ -192,12 +185,8 @@ func main() {

### Middleware & Next

Docs:

- 📖 https://fiber.wiki/routing#middleware
- 📖 https://fiber.wiki/context#next

Example:
📖 https://fiber.wiki/routing#middleware
📖 https://fiber.wiki/context#next

```go
func main() {
Expand Down Expand Up @@ -230,32 +219,34 @@ func main() {

### Template engines

Docs:
📖 https://fiber.wiki/application#settings
📖 https://fiber.wiki/context#render
📖 https://fiber.wiki/middleware#template

- 📖 https://fiber.wiki/application#settings
- 📖 https://fiber.wiki/context#render
Fiber supports the default [Go template engine](https://golang.org/pkg/html/template/)

Supported engines:
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).

- [html](https://golang.org/pkg/html/template/)
- [amber](https://github.com/eknkc/amber)
- [handlebars](https://github.com/aymerick/raymond)
- [mustache](https://github.com/cbroglie/mustache)
- [pug](https://github.com/Joker/jade)

Example:
You can use our [Template Middleware](https://fiber.wiki/middleware#template).

```go
package main

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: "mustache",
TemplateEngine: template.Mustache(),
TemplateFolder: "./views",
TemplateExtension: ".tmpl",
})

// OR after initiation app at any convenient location:
app.Settings.TemplateEngine = "mustache"
app.Settings.TemplateEngine = template.Mustache()
app.Settings.TemplateFolder = "./views"
app.Settings.TemplateExtension = ".tmpl"

Expand All @@ -273,11 +264,7 @@ func main() {

### Grouping routes into chains

Docs:

- 📖 https://fiber.wiki/application#group

Example:
📖 https://fiber.wiki/application#group

```go
func main() {
Expand All @@ -302,11 +289,7 @@ func main() {

### Middleware logger

Docs:

- 📖 https://fiber.wiki/middleware#logger

Example:
📖 https://fiber.wiki/middleware#logger

```go
import (
Expand All @@ -332,11 +315,7 @@ func main() {

### Cross-Origin Resource Sharing (CORS)

Docs:

- 📖 https://fiber.wiki/middleware#cors

Example:
📖 https://fiber.wiki/middleware#cors

```go
import (
Expand All @@ -362,11 +341,7 @@ curl -H "Origin: http://example.com" --verbose http://localhost:3000

### Custom 404 response

Docs:

- 📖 https://fiber.wiki/application#http-methods

Example:
📖 https://fiber.wiki/application#http-methods

```go
func main() {
Expand Down Expand Up @@ -394,11 +369,7 @@ func main() {

### JSON Response

Docs:

- 📖 https://fiber.wiki/context#json

Example:
📖 https://fiber.wiki/context#json

```go
type User struct {
Expand Down Expand Up @@ -426,13 +397,9 @@ func main() {
}
```

### WebSocket middleware
### WebSocket Upgrade

Docs:

- 📖 https://fiber.wiki/middleware#websocket

Example:
📖 https://fiber.wiki/middleware#websocket

```go
import (
Expand Down Expand Up @@ -466,11 +433,7 @@ func main() {

### Recover middleware

Docs:

- 📖 https://fiber.wiki/middleware#recover

Example:
📖 https://fiber.wiki/middleware#recover

```go
import (
Expand Down Expand Up @@ -532,11 +495,7 @@ If you want to say **thank you** and/or support the active development of `Fiber
4. Help us to translate this `README` to another language.


## ☕ Supporters

<a href="https://www.buymeacoffee.com/fenny" target="_blank">
<img src="https://github.com/gofiber/docs/blob/master/static/buy-morning-coffee-3x.gif" alt="Buy Me A Coffee" height="100" >
</a>
## ☕ Coffee Supporters

<table>
<tr>
Expand Down Expand Up @@ -585,6 +544,10 @@ If you want to say **thank you** and/or support the active development of `Fiber
</tr>
</table>

<a href="https://www.buymeacoffee.com/fenny" target="_blank">
<img src="https://github.com/gofiber/docs/blob/master/static/buy-morning-coffee-3x.gif" alt="Buy Me A Coffee" height="100" >
</a>

## ⭐️ Stars

<a href="https://starchart.cc/gofiber/fiber" rel="nofollow"><img src="https://starchart.cc/gofiber/fiber.svg" alt="Stars over time" style="max-width:100%;"></a>
Expand Down
Loading

0 comments on commit 9f2b087

Please sign in to comment.