Skip to content

Commit 84175b5

Browse files
committed
code update: add health check
1 parent 9c7cbdc commit 84175b5

5 files changed

Lines changed: 6 additions & 76 deletions

File tree

cmd/worker/main.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ func main() {
3232
"send_confirmation_email": func(toEmail, token, name string, host string) error {
3333
return task.TaskSendConfirmationEmail(toEmail, token, name, host)
3434
},
35-
"send_confirmation_email_gmail": func(toEmail, token, name string, host string) error {
36-
return task.TaskSendConfirmationEmailSMTP(toEmail, token, name, host)
37-
},
3835
})
3936
if err != nil {
4037
log.Fatalf("Failed to register tasks: %v", err)

internal/controller/router.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ func (r *Router) setupRoutes(services *Services) {
5656
// Configure JWT middleware
5757
r.setupJWTMiddleware()
5858

59+
// health check
60+
r.app.Get("/", func(c *fiber.Ctx) error {
61+
return c.Status(fiber.StatusOK).JSON(fiber.Map{"message": "Welcome to the API"})
62+
63+
})
5964
// Public routes (no authentication)
6065
auth := r.app.Group("/api/v1/auth")
6166
r.setupAuthRoutes(auth, services.UserService, services.Server)
@@ -110,6 +115,7 @@ func (r *Router) setupProtectedRoutes(group fiber.Router, services *Services) {
110115
// isExcludedRoute checks if a path should bypass JWT authentication
111116
func isExcludedRoute(path string) bool {
112117
excludedRoutes := []string{
118+
"/",
113119
"/api/v1/auth/login",
114120
"/api/v1/auth/register",
115121
"/api/v1/auth/logout",

internal/infra/config/model.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,4 @@ type AppConfig struct {
4646
SecretKey string `yaml:"secret_key_sqs" env:"SECRET_SQS"`
4747
Endpoint string `yaml:"endpoint_sqs" env:"ENDPOINT_SQS"`
4848
} `yaml:"sqs"`
49-
GmailSMTP struct {
50-
From string `yaml:"from" env:"EMAIL_FROM"`
51-
Password string `yaml:"password" env:"password_gmail_smtp"`
52-
SMTPHost string `yaml:"smtp_host" env:"host_smtp"`
53-
SMTPPort string `yaml:"smtp_port" env:"port_smtp"`
54-
} `yaml:"gmail"`
5549
}

internal/infra/google/gmail.go

Lines changed: 0 additions & 62 deletions
This file was deleted.

internal/task/email.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@ package task
22

33
import (
44
"project-api/internal/infra/aws"
5-
"project-api/internal/infra/google"
65
)
76

87
func TaskSendConfirmationEmail(toEmail string, token string, name string, host string) error {
98
return aws.SendConfirmationEmail(toEmail, token, name, host)
109
}
11-
12-
func TaskSendConfirmationEmailSMTP(toEmail string, token string, name string, host string) error {
13-
return google.SendConfirmationEmailSMTP(toEmail, token, name, host)
14-
}

0 commit comments

Comments
 (0)