Skip to content

Commit

Permalink
feat: Add health handler
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetumit committed Nov 5, 2023
1 parent a6acc63 commit 93e167a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/adapters/rest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ func NewServer(logger ports.Logger, config *ServerConfig, app ports.AppRunner, o
}
}
func (s *Server) initHandlers(r *chi.Mux) {
r.HandleFunc("/health", s.HealthHandler)
r.HandleFunc("/*", s.RedirectionHandler)
}
func (s *Server) HealthHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
func (s *Server) RedirectionHandler(w http.ResponseWriter, r *http.Request) {
to, err := s.app.FindRedirect(r.Context(), r.URL.String())
if err != nil {
Expand Down

0 comments on commit 93e167a

Please sign in to comment.