Skip to content

Commit

Permalink
Feat(health): any method
Browse files Browse the repository at this point in the history
  • Loading branch information
arnonsang committed Jul 7, 2024
1 parent cddd151 commit 6372a7a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions presentation/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ func (s *Server) setupMiddleware() {
AllowOrigins: []string{"*"},
AllowMethods: []string{http.MethodGet, http.MethodPost},
}))
// s.e.Use(middleware.Secure())
// s.e.Use(middleware.RequestID())
// s.e.Use(middleware.CSRF())
// s.e.Use(middleware.Gzip())
// s.e.Use(middleware.Decompress())
s.e.Use(middleware.Secure())
s.e.Use(middleware.RequestID())
s.e.Use(middleware.CSRF())
s.e.Use(middleware.Gzip())
s.e.Use(middleware.Decompress())
s.e.Use(middleware.BodyLimit("2M"))
s.e.Use(middleware.RateLimiter(middleware.NewRateLimiterMemoryStore(20)))
s.e.Use(middleware.TimeoutWithConfig(middleware.TimeoutConfig{
Expand All @@ -66,13 +66,10 @@ func (s *Server) setupRoutes() {
s.e.POST("/api/sentence", s.checkSentence)
s.e.GET("/api/replacer/:sentence", s.sentenceReplacer)
s.e.POST("/api/replacer", s.sentenceReplacer)
s.e.GET("/healthz", func(c echo.Context) error {
s.e.Any("/healthz", func(c echo.Context) error {
res := map[string]string{"status": "ok"}
return c.JSON(http.StatusOK, res)
})
s.e.HEAD("/healthz", func(c echo.Context) error {
return c.NoContent(http.StatusOK)
})
}

func (s *Server) getWord(c echo.Context) error {
Expand Down

0 comments on commit 6372a7a

Please sign in to comment.