mirror of
https://github.com/labstack/echo.git
synced 2024-11-24 08:22:21 +02:00
Adds example to readme (#1044)
This commit is contained in:
parent
2769113edf
commit
65f3fcbfe2
31
README.md
31
README.md
@ -30,6 +30,37 @@
|
||||
|
||||
## [Get Started](https://echo.labstack.com/guide)
|
||||
|
||||
### Example:
|
||||
|
||||
```
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo"
|
||||
"github.com/labstack/echo/middleware"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Echo instance
|
||||
e := echo.New()
|
||||
// Middleware
|
||||
e.Use(middleware.Logger())
|
||||
e.Use(middleware.Recover())
|
||||
// Routes
|
||||
e.GET("/", hello)
|
||||
// Start server
|
||||
e.Logger.Fatal(e.Start(":1323"))
|
||||
}
|
||||
|
||||
// Handler
|
||||
func hello(c echo.Context) error {
|
||||
return c.String(http.StatusOK, "Hello, World!")
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Support Us
|
||||
|
||||
- :star: the project
|
||||
|
Loading…
Reference in New Issue
Block a user