diff options
Diffstat (limited to 'vendor/github.com/labstack/echo/cookbook/google-app-engine')
6 files changed, 0 insertions, 155 deletions
diff --git a/vendor/github.com/labstack/echo/cookbook/google-app-engine/app-engine.go b/vendor/github.com/labstack/echo/cookbook/google-app-engine/app-engine.go deleted file mode 100644 index 0c1db087..00000000 --- a/vendor/github.com/labstack/echo/cookbook/google-app-engine/app-engine.go +++ /dev/null @@ -1,17 +0,0 @@ -// +build appengine - -package main - -import ( - "net/http" - - "github.com/labstack/echo" -) - -func createMux() *echo.Echo { - e := echo.New() - // note: we don't need to provide the middleware or static handlers, that's taken care of by the platform - // app engine has it's own "main" wrapper - we just need to hook echo into the default handler - http.Handle("/", e) - return e -} diff --git a/vendor/github.com/labstack/echo/cookbook/google-app-engine/app-managed.go b/vendor/github.com/labstack/echo/cookbook/google-app-engine/app-managed.go deleted file mode 100644 index 7b8eacf8..00000000 --- a/vendor/github.com/labstack/echo/cookbook/google-app-engine/app-managed.go +++ /dev/null @@ -1,25 +0,0 @@ -// +build appenginevm - -package main - -import ( - "net/http" - - "github.com/labstack/echo" - "google.golang.org/appengine" -) - -func createMux() *echo.Echo { - e := echo.New() - // note: we don't need to provide the middleware or static handlers - // for the appengine vm version - that's taken care of by the platform - return e -} - -func main() { - // the appengine package provides a convenient method to handle the health-check requests - // and also run the app on the correct port. We just need to add Echo to the default handler - e := echo.New(":8080") - http.Handle("/", e) - appengine.Main() -} diff --git a/vendor/github.com/labstack/echo/cookbook/google-app-engine/app-standalone.go b/vendor/github.com/labstack/echo/cookbook/google-app-engine/app-standalone.go deleted file mode 100644 index c3b44dc0..00000000 --- a/vendor/github.com/labstack/echo/cookbook/google-app-engine/app-standalone.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build !appengine,!appenginevm - -package main - -import ( - "github.com/labstack/echo" - "github.com/labstack/echo/middleware" -) - -func createMux() *echo.Echo { - e := echo.New() - - e.Use(middleware.Recover()) - e.Use(middleware.Logger()) - e.Use(middleware.Gzip()) - - e.Static("/", "public") - - return e -} - -func main() { - e.Logger.Fatal(e.Start(":8080")) -} diff --git a/vendor/github.com/labstack/echo/cookbook/google-app-engine/app.go b/vendor/github.com/labstack/echo/cookbook/google-app-engine/app.go deleted file mode 100644 index 8d4d97a2..00000000 --- a/vendor/github.com/labstack/echo/cookbook/google-app-engine/app.go +++ /dev/null @@ -1,4 +0,0 @@ -package main - -// reference our echo instance and create it early -var e = createMux() diff --git a/vendor/github.com/labstack/echo/cookbook/google-app-engine/users.go b/vendor/github.com/labstack/echo/cookbook/google-app-engine/users.go deleted file mode 100644 index 19533e51..00000000 --- a/vendor/github.com/labstack/echo/cookbook/google-app-engine/users.go +++ /dev/null @@ -1,54 +0,0 @@ -package main - -import ( - "net/http" - - "github.com/labstack/echo" - "github.com/labstack/echo/middleware" -) - -type ( - user struct { - ID string `json:"id"` - Name string `json:"name"` - } -) - -var ( - users map[string]user -) - -func init() { - users = map[string]user{ - "1": user{ - ID: "1", - Name: "Wreck-It Ralph", - }, - } - - // hook into the echo instance to create an endpoint group - // and add specific middleware to it plus handlers - g := e.Group("/users") - g.Use(middleware.CORS()) - - g.POST("", createUser) - g.GET("", getUsers) - g.GET("/:id", getUser) -} - -func createUser(c echo.Context) error { - u := new(user) - if err := c.Bind(u); err != nil { - return err - } - users[u.ID] = *u - return c.JSON(http.StatusCreated, u) -} - -func getUsers(c echo.Context) error { - return c.JSON(http.StatusOK, users) -} - -func getUser(c echo.Context) error { - return c.JSON(http.StatusOK, users[c.Param("id")]) -} diff --git a/vendor/github.com/labstack/echo/cookbook/google-app-engine/welcome.go b/vendor/github.com/labstack/echo/cookbook/google-app-engine/welcome.go deleted file mode 100644 index 2639b209..00000000 --- a/vendor/github.com/labstack/echo/cookbook/google-app-engine/welcome.go +++ /dev/null @@ -1,31 +0,0 @@ -package main - -import ( - "html/template" - "io" - "net/http" - - "github.com/labstack/echo" -) - -type ( - Template struct { - templates *template.Template - } -) - -func init() { - t := &Template{ - templates: template.Must(template.ParseFiles("templates/welcome.html")), - } - e.Renderer = t - e.GET("/welcome", welcome) -} - -func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error { - return t.templates.ExecuteTemplate(w, name, data) -} - -func welcome(c echo.Context) error { - return c.Render(http.StatusOK, "welcome", "Joe") -} |