feat(debugger): 🚧 WIP add upgrade client-server detector

Add CD for deploying merged pull request client and server packages
This commit is contained in:
pakintada@gmail.com 2024-04-01 09:38:34 +07:00
parent 387af2efa9
commit 2c5b28c0b9
7 changed files with 94 additions and 10 deletions

View file

@ -175,6 +175,23 @@ func (s *Server) createHandler() {
json.NewEncoder(w).Encode(map[string]string{"message": fmt.Sprintf("path %s are not exits", r.RequestURI)})
})
// server status
// upgrade
r.Route("/upgrade", func(r chi.Router) {
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
json.NewEncoder(w).Encode(map[string]string{"message": "upgrade"})
// fmt.Fprintf(w, "upgrade")
// add delay for 10 secs
// TODO: send to upgrade listener
// s.server.Shutdown(context.Background())
})
})
// display all routes [DEBUG]
chi.Walk(r, func(method string, route string, handler http.Handler, middlewares ...func(http.Handler) http.Handler) error {
//fmt.Println(method, " ---> ", route)