This commit is contained in:
Egor Pozharov
2026-04-14 16:17:22 +06:00
parent b36a6fb262
commit 7f410e814b
3 changed files with 26 additions and 10 deletions

View File

@@ -5,9 +5,11 @@ import (
"log"
"net/http"
"os"
"time"
db "github.com/chedius/delivery-tracker/internal/db/sqlc"
"github.com/chedius/delivery-tracker/internal/delivery"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/joho/godotenv"
@@ -29,6 +31,15 @@ func main() {
r := gin.Default()
// CORS middleware - allow all origins in development
r.Use(cors.New(cors.Config{
AllowOrigins: []string{"*"},
AllowMethods: []string{"GET", "POST", "PATCH", "PUT", "DELETE", "OPTIONS"},
AllowHeaders: []string{"*"},
AllowCredentials: false,
MaxAge: 12 * time.Hour,
}))
r.GET("/health", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"status": "ok"})
})