mirror of https://github.com/gin-gonic/gin.git
Added Google App Engine Example
This commit is contained in:
parent
2e50e2cc60
commit
6b5e80901f
|
@ -0,0 +1,8 @@
|
||||||
|
application: hello
|
||||||
|
version: 1
|
||||||
|
runtime: go
|
||||||
|
api_version: go1
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- url: /.*
|
||||||
|
script: _go_app
|
|
@ -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)
|
||||||
|
}
|
Loading…
Reference in New Issue