|
- package main
-
- import (
- "log"
- "net/http"
- "text/template"
- )
-
- func main() {
- //readConfig()
- readConfigForTest()
- db.h = nil //make sure it's in proper state.
-
- 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")
- }
-
- func errPage(w http.ResponseWriter, code int, msg string) {
- var data struct {
- ErrorMessage string
- }
- data.ErrorMessage = msg
- w.WriteHeader(code)
- t := template.Must(template.ParseFiles("PG/error.html"))
- t.Execute(w, data)
- }
|