()
| 74 | } |
| 75 | |
| 76 | func main() { |
| 77 | fmt.Println("My Simple Server") |
| 78 | |
| 79 | r := mux.NewRouter() |
| 80 | |
| 81 | ////////////////////////////////////////////////// |
| 82 | //////////////////// FUNDS RUB /////////////////// |
| 83 | ////////////////////////////////////////////////// |
| 84 | |
| 85 | //GET |
| 86 | r.Handle("/funds/rub/shares", isAuthorized(getRUBFundsShares)).Methods("GET") |
| 87 | r.Handle("/funds/rub/bonds", isAuthorized(getRUBFundsBonds)).Methods("GET") |
| 88 | |
| 89 | r.Handle("/funds/usd/shares", isAuthorized(getUSDFundsShares)).Methods("GET") |
| 90 | r.Handle("/funds/usd/bonds", isAuthorized(getUSDFundsBonds)).Methods("GET") |
| 91 | |
| 92 | //POST |
| 93 | r.Handle("/funds/rub", isAuthorized(createFund)).Methods("POST") |
| 94 | |
| 95 | ////////////////////////////////////////////////// |
| 96 | ////////////////////// Login ///////////////////// |
| 97 | ////////////////////////////////////////////////// |
| 98 | |
| 99 | //POST |
| 100 | r.HandleFunc("/login", login).Methods("POST") |
| 101 | |
| 102 | log.Fatal(http.ListenAndServe(":8000", r)) |
| 103 | } |
| 104 | |
| 105 | func getRUBFundsShares(w http.ResponseWriter, r *http.Request) { |
| 106 | w.Header().Set("Access-Control-Allow-Origin", "*") |
nothing calls this directly
no test coverage detected