Skip to content

Commit

Permalink
feat: add status api to detect api ready
Browse files Browse the repository at this point in the history
  • Loading branch information
hunjixin committed Feb 20, 2023
1 parent 6ee8513 commit ce436ca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ func RunAPI(lc fx.Lifecycle, localAuthCli *jwtclient.LocalAuthClient, remoteAuth
srv.Register("Message", msgImp)
handler := http.NewServeMux()
handler.Handle("/rpc/v0", srv)
handler.HandleFunc("/status", func(res http.ResponseWriter, _ *http.Request) {
res.Write([]byte("OK"))
res.WriteHeader(http.StatusOK)
})

authMux := jwtclient.NewAuthMux(localAuthCli, jwtclient.WarpIJwtAuthClient(remoteAuthCli), handler)
authMux.TrustHandle("/debug/pprof/", http.DefaultServeMux)

Expand Down

0 comments on commit ce436ca

Please sign in to comment.