You've already forked golang-saas-starter-kit
mirror of
https://github.com/raseels-repos/golang-saas-starter-kit.git
synced 2025-06-15 00:15:15 +02:00
checkpoint
This commit is contained in:
@ -28,10 +28,10 @@ func (c *Check) Health(ctx context.Context, w http.ResponseWriter, r *http.Reque
|
||||
}
|
||||
|
||||
// check redis
|
||||
//err = c.Redis.Ping().Err()
|
||||
//if err != nil {
|
||||
// return errors.Wrap(err, "Redis failed")
|
||||
//}
|
||||
err = c.Redis.Ping().Err()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Redis failed")
|
||||
}
|
||||
|
||||
status := struct {
|
||||
Status string `json:"status"`
|
||||
@ -41,3 +41,11 @@ func (c *Check) Health(ctx context.Context, w http.ResponseWriter, r *http.Reque
|
||||
|
||||
return web.RespondJson(ctx, w, status, http.StatusOK)
|
||||
}
|
||||
|
||||
// Ping validates the service is ready to accept requests.
|
||||
func (c *Check) Ping(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error {
|
||||
|
||||
status := "pong"
|
||||
|
||||
return web.RespondJson(ctx, w, status, http.StatusOK)
|
||||
}
|
||||
|
@ -23,8 +23,10 @@ func API(shutdown chan os.Signal, log *log.Logger, masterDB *sqlx.DB, redis *red
|
||||
// Register health check endpoint. This route is not authenticated.
|
||||
check := Check{
|
||||
MasterDB: masterDB,
|
||||
Redis: redis,
|
||||
}
|
||||
app.Handle("GET", "/v1/health", check.Health)
|
||||
app.Handle("GET", "/ping", check.Ping)
|
||||
|
||||
// Register user management and authentication endpoints.
|
||||
u := User{
|
||||
|
Reference in New Issue
Block a user