|
|
@ -1,6 +1,9 @@
|
|
|
|
package api
|
|
|
|
package api
|
|
|
|
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
import (
|
|
|
|
|
|
|
|
"encoding/gob"
|
|
|
|
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type Server struct {
|
|
|
|
type Server struct {
|
|
|
|
Debug bool
|
|
|
|
Debug bool
|
|
|
@ -11,13 +14,16 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
|
|
w.Header().Set("Access-Control-Allow-Headers", "*")
|
|
|
|
w.Header().Set("Access-Control-Allow-Headers", "*")
|
|
|
|
w.Header().Set("Access-Control-Allow-Methods", "*")
|
|
|
|
w.Header().Set("Access-Control-Allow-Methods", "*")
|
|
|
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
|
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
|
|
|
|
|
|
|
|
|
|
if r.Method == "OPTIONS" {
|
|
|
|
if r.Method == "OPTIONS" {
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gob.Register([]interface{}{})
|
|
|
|
|
|
|
|
gob.Register(map[string]interface{}{})
|
|
|
|
|
|
|
|
|
|
|
|
switch r.URL.Path {
|
|
|
|
switch r.URL.Path {
|
|
|
|
case "/account/info":
|
|
|
|
case "/account/info":
|
|
|
|
s.HandleAccountInfo(w, r)
|
|
|
|
s.HandleAccountInfo(w, r)
|
|
|
|