initial thai translation

This commit is contained in:
Tavee Khunbida
2019-01-08 15:54:55 +07:00
parent 55e90cb934
commit 454ac1fe6c
469 changed files with 17014 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
// Example code for Chapter 3.2 from "Build Web Application with Golang"
// Purpose: Shows how to acces the form values from the request
package main
import (
"fmt"
"log"
"net/http"
"strings"
)
func sayhelloName(w http.ResponseWriter, r *http.Request) {
r.ParseForm() // parse arguments, you have to call this by yourself
fmt.Println(r.Form) // print form information in server side
fmt.Println("path", r.URL.Path)
fmt.Println("scheme", r.URL.Scheme)
fmt.Println(r.Form["url_long"])
for k, v := range r.Form {
fmt.Println("key:", k)
fmt.Println("val:", strings.Join(v, ""))
}
fmt.Fprintf(w, "Hello astaxie!") // send data to client side
}
func main() {
http.HandleFunc("/", sayhelloName) // set router
err := http.ListenAndServe(":9090", nil) // set listen port
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}