The code below just gives me an error that it cannot find the echo.Context
Should just run
>> go run echo.go
# command-line-arguments
./echo.go:18: echo.Context undefined (type *echo.Echo has no field or method Context)
run the code below
package main
package main
import (
"log"
"time"
"net/http"
"github.com/labstack/echo"
"github.com/labstack/echo/engine/fasthttp"
)
func main() {
echo := echo.New()
fasthttp_engine := fasthttp.New(":8080")
fasthttp_engine.ReadTimeout = 2 * time.Second
fasthttp_engine.WriteTimeout = 2 * time.Second
echo.GET("/", func(c echo.Context) error {
//log.Println("Request GET '/'")
res := []string{"Hello", "World"}
return c.JSON(http.StatusOK, res)
})
log.Println("Starting Server on Port :8080")
log.Fatal(echo.Run(fasthttp_engine))
}
go 1.7.3
I found it - doh!
what's the problem?