|
|
|
@@ -1,6 +1,7 @@ |
|
|
|
package main |
|
|
|
|
|
|
|
import ( |
|
|
|
"biukop.com/sfm/loan" |
|
|
|
"fmt" |
|
|
|
"log" |
|
|
|
"net/http" |
|
|
|
@@ -8,11 +9,46 @@ import ( |
|
|
|
|
|
|
|
func main() { |
|
|
|
|
|
|
|
err := config.readConfig() //wechat API config |
|
|
|
if err != nil { |
|
|
|
log.Println(err) |
|
|
|
log.Fatalf("unable to read %s, program quit\n", configFile) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
setupRootFileServer() |
|
|
|
//always the last one |
|
|
|
setupHTTPHandler() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func setupRootFileServer() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func setupHTTPHandler() { |
|
|
|
http.HandleFunc("/api", HelloHandler) |
|
|
|
http.HandleFunc("/upload", HelloHandler) |
|
|
|
http.HandleFunc("/crmfiles/", HelloHandler) |
|
|
|
http.HandleFunc("/dumprequest", HelloHandler) |
|
|
|
http.HandleFunc("/MP_verify_6JqVkftKr39GMakA.txt", HelloHandler) |
|
|
|
http.HandleFunc("/spa/redirect", HelloHandler) |
|
|
|
http.HandleFunc("/iapi/getAccessToken", HelloHandler) |
|
|
|
http.HandleFunc("/iapi/createWechatQr", HelloHandler) |
|
|
|
http.HandleFunc("/crmpixel.png", HelloHandler) //tracking pixel. |
|
|
|
http.HandleFunc("/crmcache", HelloHandler) |
|
|
|
http.HandleFunc("/spa/editprofile", HelloHandler) |
|
|
|
http.HandleFunc("/spa/livecast", HelloHandler) |
|
|
|
http.HandleFunc("/spa/editmeeting", HelloHandler) |
|
|
|
|
|
|
|
http.HandleFunc("/", HelloHandler) |
|
|
|
fmt.Println("Server started at port 8080") |
|
|
|
log.Fatal(http.ListenAndServe(":8080", nil)) |
|
|
|
fmt.Printf("Server started at port %s\n", config.Port) |
|
|
|
log.Fatal(http.ListenAndServe(config.Host+":"+config.Port, nil)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func HelloHandler(w http.ResponseWriter, r *http.Request) { |
|
|
|
fmt.Fprintf(w, "Hello, there\n") |
|
|
|
p := loan.People{} |
|
|
|
p.FakeNew() |
|
|
|
fmt.Fprintf(w, "Hello, there %s, %+v\n", loan.Version, p) |
|
|
|
} |