2016-03-11 07:40:25 +02:00
# *NOTICE*
- Master branch, website and godoc now points to Echo v2.
2016-03-11 08:22:42 +02:00
- It is advisable to migrate to v2. (https://labstack.com/echo/guide/migrating)
2016-03-11 07:40:25 +02:00
- Looking for v1?
- Installation: Use a package manager (https://github.com/Masterminds/glide, it's nice!) to get stable v1 release/commit or use `go get gopkg.in/labstack/echo.v1` .
- Godoc: https://godoc.org/gopkg.in/labstack/echo.v1
2016-03-22 04:57:26 +02:00
- Docs: https://github.com/labstack/echo/tree/v1.4/website/content
2015-12-22 01:20:49 +02:00
2015-10-08 22:54:31 +02:00
# [Echo](http://labstack.com/echo) [![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/labstack/echo) [![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/labstack/echo/master/LICENSE) [![Build Status](http://img.shields.io/travis/labstack/echo.svg?style=flat-square)](https://travis-ci.org/labstack/echo) [![Coverage Status](http://img.shields.io/coveralls/labstack/echo.svg?style=flat-square)](https://coveralls.io/r/labstack/echo) [![Join the chat at https://gitter.im/labstack/echo](https://img.shields.io/badge/gitter-join%20chat-brightgreen.svg?style=flat-square)](https://gitter.im/labstack/echo)
2015-06-30 21:10:35 +02:00
2016-02-09 23:39:47 +02:00
**A fast and unfancy micro web framework for Go.**
2016-02-09 21:46:08 +02:00
2016-03-11 08:22:42 +02:00
## Features
- Fast HTTP router which smartly prioritize routes.
- Run with standard HTTP server or FastHTTP server.
- Extensible middleware framework.
- Router groups with nesting.
- Handy functions to send variety of HTTP responses.
- Centralized HTTP error handling.
- Template rendering with any template engine.
## Performance
Based on [vishr/go-http-routing-benchmark] (https://github.com/vishr/go-http-routing-benchmark), June 5, 2015.
![Performance ](http://i.imgur.com/hB2qdRS.png )
## Getting Started
### Installation
```sh
2016-03-27 19:25:31 +02:00
$ go get github.com/labstack/echo/...
2016-03-11 08:22:42 +02:00
```
### Hello, World!
Create `main.go`
2016-02-09 21:46:08 +02:00
```go
package main
import (
2016-03-11 08:22:42 +02:00
"net/http"
2016-02-09 21:46:08 +02:00
"github.com/labstack/echo"
2016-02-10 03:16:46 +02:00
"github.com/labstack/echo/engine/standard"
2016-03-11 07:40:25 +02:00
"github.com/labstack/echo/middleware"
2016-02-09 21:46:08 +02:00
)
2016-03-11 08:22:42 +02:00
// Handler
func hello() echo.HandlerFunc {
return func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!\n")
}
}
2016-02-09 21:46:08 +02:00
func main() {
2016-03-11 08:22:42 +02:00
// Echo instance
2016-02-09 21:46:08 +02:00
e := echo.New()
2016-03-11 08:22:42 +02:00
// Middleware
2016-03-11 07:40:25 +02:00
e.Use(middleware.Logger())
e.Use(middleware.Recover())
2016-02-09 21:46:08 +02:00
2016-03-11 08:22:42 +02:00
// Routes
e.Get("/", hello())
2016-02-09 21:46:08 +02:00
2016-03-11 08:22:42 +02:00
// Start server
2016-03-06 06:03:11 +02:00
e.Run(standard.New(":1323"))
2016-02-09 21:46:08 +02:00
}
```
2015-03-12 23:51:39 +02:00
2016-03-11 08:22:42 +02:00
Start server
2015-04-19 01:47:48 +02:00
2016-03-11 08:22:42 +02:00
```sh
$ go run main.go
```
2015-04-19 01:47:48 +02:00
2016-03-11 08:22:42 +02:00
Browse to [http://localhost:1323 ](http://localhost:1323 ) and you should see
Hello, World! on the page.
2015-04-16 19:18:35 +02:00
2016-03-11 08:22:42 +02:00
### Next?
2016-03-12 04:26:16 +02:00
- Browse [recipes ](https://labstack.com/echo/recipes/hello-world )
- Head over to [guide ](https://labstack.com/echo/guide/installation )
2015-04-16 19:18:35 +02:00
2015-04-26 01:10:28 +02:00
## Contribute
**Use issues for everything**
2015-04-27 07:41:41 +02:00
2016-03-11 08:22:42 +02:00
- Report issues
- Discuss before sending pull request
- Suggest new features
2015-04-26 01:10:28 +02:00
- Improve/fix documentation
## Credits
- [Vishal Rana ](https://github.com/vishr ) - Author
- [Nitin Rana ](https://github.com/nr17 ) - Consultant
- [Contributors ](https://github.com/labstack/echo/graphs/contributors )
2016-03-11 08:22:42 +02:00
## License
[MIT ](https://github.com/labstack/echo/blob/master/LICENSE )