aboutsummaryrefslogtreecommitdiff
path: root/content/appengine
diff options
context:
space:
mode:
authorTyler Bui-Palsulich <tbp@google.com>2018-10-15 13:20:20 -0400
committerKatie Hockman <katie@golang.org>2018-10-15 20:27:04 +0000
commit8663ebbad975bff0b46cf08bbabca2afa6d306c0 (patch)
tree8ccdf960bf5cb05280df99343ef49a093a5a4d0e /content/appengine
parent58f5eaf410446acb631277644d1036cb83fd31eb (diff)
content: add appengine-go111 article
Change-Id: I18e78cc284a85dbf59cdf7841a124b4cf967469e Reviewed-on: https://go-review.googlesource.com/c/142118 Reviewed-by: Katie Hockman <katie@golang.org>
Diffstat (limited to 'content/appengine')
-rw-r--r--content/appengine/main.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/content/appengine/main.go b/content/appengine/main.go
new file mode 100644
index 0000000..ac8feda
--- /dev/null
+++ b/content/appengine/main.go
@@ -0,0 +1,23 @@
+// This server can run on App Engine.
+package main
+
+import (
+ "fmt"
+ "log"
+ "net/http"
+ "os"
+)
+
+func main() {
+ port := os.Getenv("PORT")
+ if port == "" {
+ port = "8080"
+ }
+ http.HandleFunc("/", hello)
+
+ log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil))
+}
+
+func hello(w http.ResponseWriter, r *http.Request) {
+ w.Write([]byte("Hello, 世界"))
+}