# hello **Repository Path**: haozibi/hello ## Basic Information - **Project Name**: hello - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-06-07 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # hello by **[haozibi](https://coding.net/u/haozibi)** ```go package main import ( "fmt" "net/http" "github.com/haozibi/hello" ) func main() { mux := http.NewServeMux() mux.Handle("/favicon.ico", http.FileServer(http.Dir("public"))) mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { fmt.Fprintf(w, "success !\r\nhello by haozibi!") }) mux.Handle("/test", &test{}) mux.HandleFunc("/json", JsonPage) h := hello.DefaultHello() h.UseHandler(mux) h.Run(":3000") } type test struct{} func (t *test) ServeHTTP(rw http.ResponseWriter, req *http.Request) { fmt.Fprintf(rw, "Test Page ! \r\nhello by haozibi!") } func JsonPage(rw http.ResponseWriter, r *http.Request) { a := map[string]interface{}{ "hello": "v0.1", "web": "https://coding.net/u/haozibi/p/hello/git", } b, err := hello.ToJson(a) if err == nil { fmt.Fprintf(rw, b) } else { fmt.Fprintf(rw, err.Error()) } return } ```