Files
email-notification/main.go
2025-04-18 18:15:59 +07:00

34 lines
604 B
Go

package main
import (
"context"
"email-notification/config"
"email-notification/middleware"
"email-notification/route"
"log"
"net/http"
"os"
"github.com/joho/godotenv"
)
func main() {
log.Println("Email Notification Service")
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
http.Handle("/", middleware.ResponseTimeMiddleware(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Welcome!"))
}))
db := config.NewDatabase().WithContext(context.Background())
route.Route(db)
port := os.Getenv("PORT")
http.ListenAndServe(":"+port, nil)
}