|
3 | 3 |
|
4 | 4 | # [Echo](http://labstack.com/echo) [](http://godoc.org/github.com/labstack/echo) [](https://raw.githubusercontent.com/labstack/echo/master/LICENSE) [](https://travis-ci.org/labstack/echo) [](https://coveralls.io/r/labstack/echo) [](https://gitter.im/labstack/echo)
|
5 | 5 |
|
6 |
| -A fast and unfancy micro web framework for Go. |
7 |
| - |
8 |
| -## Features |
9 |
| - |
10 |
| -- Fast HTTP router which smartly prioritize routes. |
11 |
| -- Extensible middleware, supports: |
12 |
| - - `echo.MiddlewareFunc` |
13 |
| - - `func(echo.HandlerFunc) echo.HandlerFunc` |
14 |
| - - `echo.HandlerFunc` |
15 |
| - - `func(*echo.Context) error` |
16 |
| - - `func(http.Handler) http.Handler` |
17 |
| - - `http.Handler` |
18 |
| - - `http.HandlerFunc` |
19 |
| - - `func(http.ResponseWriter, *http.Request)` |
20 |
| -- Extensible handler, supports: |
21 |
| - - `echo.HandlerFunc` |
22 |
| - - `func(*echo.Context) error` |
23 |
| - - `http.Handler` |
24 |
| - - `http.HandlerFunc` |
25 |
| - - `func(http.ResponseWriter, *http.Request)` |
26 |
| -- Sub-router/Groups |
27 |
| -- Handy functions to send variety of HTTP response: |
28 |
| - - HTML |
29 |
| - - HTML via templates |
30 |
| - - String |
31 |
| - - JSON |
32 |
| - - JSONP |
33 |
| - - XML |
34 |
| - - File |
35 |
| - - NoContent |
36 |
| - - Redirect |
37 |
| - - Error |
38 |
| -- Build-in support for: |
39 |
| - - Favicon |
40 |
| - - Index file |
41 |
| - - Static files |
42 |
| - - WebSocket |
43 |
| -- Centralized HTTP error handling. |
44 |
| -- Customizable HTTP request binding function. |
45 |
| -- Customizable HTTP response rendering function, allowing you to use any HTML template engine. |
| 6 | +## A fast and unfancy micro web framework for Go. |
| 7 | + |
| 8 | +```go |
| 9 | +package main |
| 10 | + |
| 11 | +import ( |
| 12 | + "github.com/labstack/echo" |
| 13 | + "github.com/labstack/echo/engine" |
| 14 | + "github.com/labstack/echo/engine/fasthttp" |
| 15 | + mw "github.com/labstack/echo/middleware" |
| 16 | +) |
| 17 | + |
| 18 | +func main() { |
| 19 | + e := echo.New() |
| 20 | + e.Use(mw.Log()) |
| 21 | + e.Get("/", func(c echo.Context) error { |
| 22 | + return c.String(200, "Hello, World!") |
| 23 | + }) |
| 24 | + e.Get("/v2", func(c echo.Context) error { |
| 25 | + return c.String(200, "Echo v2") |
| 26 | + }) |
| 27 | + |
| 28 | + // FastHTTP |
| 29 | + e.RunEngine(fasthttp.NewServer(&engine.Config{ |
| 30 | + Address: ":4444", |
| 31 | + }, e.Handle, e.Logger())) |
| 32 | + |
| 33 | + // Standard |
| 34 | + // e.Run(":4444") |
| 35 | +} |
| 36 | + |
| 37 | +``` |
46 | 38 |
|
47 | 39 | ## Performance
|
48 | 40 |
|
@@ -84,28 +76,6 @@ BenchmarkVulcan_GithubAll 5000 271682 ns/op 1989
|
84 | 76 | BenchmarkZeus_GithubAll 2000 748827 ns/op 300688 B/op 2648 allocs/op
|
85 | 77 | ```
|
86 | 78 |
|
87 |
| -## Installation |
88 |
| - |
89 |
| -```sh |
90 |
| -$ go get github.com/labstack/echo |
91 |
| -``` |
92 |
| - |
93 |
| -## [Recipes](http://labstack.com/echo/recipes/hello-world) |
94 |
| - |
95 |
| -## [Guide](http://labstack.com/echo/guide/installation) |
96 |
| - |
97 |
| -## Echo System |
98 |
| - |
99 |
| -Community created packages for Echo |
100 |
| - |
101 |
| -- [echo-logrus](https://github.com/deoxxa/echo-logrus) |
102 |
| -- [go_middleware](https://github.com/rightscale/go_middleware) |
103 |
| -- [permissions2](https://github.com/xyproto/permissions2) |
104 |
| -- [permissionbolt](https://github.com/xyproto/permissionbolt) |
105 |
| -- [echo-middleware](https://github.com/syntaqx/echo-middleware) |
106 |
| -- [dpecho](https://github.com/deferpanic/dpecho) |
107 |
| -- [echosentry](https://github.com/01walid/echosentry) |
108 |
| - |
109 | 79 | ## Contribute
|
110 | 80 |
|
111 | 81 | **Use issues for everything**
|
|
0 commit comments