From 6b5e80901f70082f87e5a581ccfa4f319cf735dc Mon Sep 17 00:00:00 2001 From: Javier Provecho Fernandez Date: Wed, 2 Jul 2014 22:08:37 +0200 Subject: [PATCH] Added Google App Engine Example --- examples/app-engine/app.yaml | 8 ++++++++ examples/app-engine/hello.go | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 examples/app-engine/app.yaml create mode 100644 examples/app-engine/hello.go diff --git a/examples/app-engine/app.yaml b/examples/app-engine/app.yaml new file mode 100644 index 00000000..5f20cf3f --- /dev/null +++ b/examples/app-engine/app.yaml @@ -0,0 +1,8 @@ +application: hello +version: 1 +runtime: go +api_version: go1 + +handlers: +- url: /.* + script: _go_app \ No newline at end of file diff --git a/examples/app-engine/hello.go b/examples/app-engine/hello.go new file mode 100644 index 00000000..a6de8378 --- /dev/null +++ b/examples/app-engine/hello.go @@ -0,0 +1,22 @@ +package hello + +import ( + "net/http" + "github.com/gin-gonic/gin" +) + +func init() { + // Starts a new Gin instance with no middle-ware + r := gin.New() + + // Define your handlers + r.GET("/", func(c *gin.Context){ + c.String(200, "Hello World!") + }) + r.GET("/ping/", func(c *gin.Context){ + c.String(200, "pong") + }) + + // Handle all requests using net/http + http.Handle("/", r) +} \ No newline at end of file