gopher/hello.go
package gopher
import (
"fmt"
"net/http"
)
// The init function is called when your application starts.
func init() {
// Register a handle for /hello URLs.
http.HandleFunc("/hello", hello)
}
// hello is an HTTP handler that prints "Hello Gopher!"
func hello(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello, Gopher!")
}
gopher/app.yaml
application: gopher
version: 1
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
-
download go_appengine_sdk.zip &&
unzip go_appengine_sdk*.zip -
google_appengine/dev_appserver.py gopher/&& localhost:8080 - create an appengine application
google_appengineappcfg.py --oauth2 -A your_app_id update gopher/- your_app_id.appspot.com