package endpoints // this endpoint server at "/user/login" will show the login page or // directly login the user based on the http method used import "net/http" func LoginHandler(w http.ResponseWriter, r *http.Request) { switch r.Method { case http.MethodGet: showLoginPage(w, r, true, "") case http.MethodPost: loginUser(w, r) default: http.Error(w, "Method not allowed!", http.StatusMethodNotAllowed) } }