| @@ -3,7 +3,9 @@ package main | |||
| import ( | |||
| "log" | |||
| "net/http" | |||
| "os" | |||
| "text/template" | |||
| "time" | |||
| ) | |||
| func main() { | |||
| @@ -11,20 +13,25 @@ func main() { | |||
| readConfigForTest() | |||
| db.h = nil //make sure it's in proper state. | |||
| filename := "rpn.superforex." + time.Now().Format("20060102150406") + ".log" | |||
| f, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) | |||
| if err != nil { | |||
| log.Fatalf("error opening file: %v", err) | |||
| } | |||
| defer f.Close() | |||
| log.SetOutput(f) | |||
| log.Println("Server started on: http://localhost:8080") | |||
| //setup http handler | |||
| http.HandleFunc("/choosePayment", choosePayment) | |||
| http.HandleFunc("/rpnNameAndCard", rpnNameAndCard) | |||
| http.HandleFunc("/rpn_notify", rpnNotify) //called by rpn | |||
| // http.HandleFunc("/", Index) | |||
| // http.HandleFunc("/show", Show) | |||
| // http.HandleFunc("/new", New) | |||
| // http.HandleFunc("/edit", Edit) | |||
| // http.HandleFunc("/insert", Insert) | |||
| // http.HandleFunc("/update", Update) | |||
| // http.HandleFunc("/delete", Delete) | |||
| fs := wrapHandler(http.FileServer(http.Dir("./PG"))) | |||
| http.HandleFunc("/", fs) | |||
| http.ListenAndServe(":8080", nil) | |||
| log.Println("Server started on: http://localhost:8080") | |||
| //start log file | |||
| } | |||
| func errPage(w http.ResponseWriter, code int, msg string) { | |||