Added Google App Engine Example
This commit is contained in:
		
							
								
								
									
										8
									
								
								examples/app-engine/app.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								examples/app-engine/app.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
			
		||||
application: hello
 | 
			
		||||
version: 1
 | 
			
		||||
runtime: go
 | 
			
		||||
api_version: go1
 | 
			
		||||
 | 
			
		||||
handlers:
 | 
			
		||||
- url: /.*
 | 
			
		||||
  script: _go_app
 | 
			
		||||
							
								
								
									
										22
									
								
								examples/app-engine/hello.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								examples/app-engine/hello.go
									
									
									
									
									
										Normal file
									
								
							@ -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)
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user