diff --git a/server/server.go b/server/server.go index bfae3d7..765e94f 100644 --- a/server/server.go +++ b/server/server.go @@ -11,11 +11,12 @@ import ( // TODO proper doc comments! -const API_VERSION = 1 +const ApiVersion = "1" +const PathPrefix = "/api/" + ApiVersion -const PathAuthToken = "/auth/full" -const PathRegister = "/signup" -const PathWallet = "/wallet" +const PathAuthToken = PathPrefix + "/auth/full" +const PathRegister = PathPrefix + "/signup" +const PathWallet = PathPrefix + "/wallet" type Server struct { auth auth.AuthInterface @@ -152,10 +153,9 @@ func (s *Server) checkAuth( // PUT = "...creates a new resource or replaces a representation of the target resource with the request payload." func (s *Server) Serve() { - PathPrefix := fmt.Sprintf("/api/%d", API_VERSION) - http.HandleFunc(PathPrefix+PathAuthToken, s.getAuthToken) - http.HandleFunc(PathPrefix+PathWallet, s.handleWallet) - http.HandleFunc(PathPrefix+PathRegister, s.register) + http.HandleFunc(PathAuthToken, s.getAuthToken) + http.HandleFunc(PathWallet, s.handleWallet) + http.HandleFunc(PathRegister, s.register) fmt.Println("Serving at localhost:8090") http.ListenAndServe("localhost:8090", nil)