tambahan cors
This commit is contained in:
@@ -2,15 +2,21 @@ package server
|
||||
|
||||
import (
|
||||
"api-lis/pkg/middleware"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
|
||||
dataretribusiHandler "api-lis/pkg/handlers/data_retribusi"
|
||||
)
|
||||
|
||||
func (s *Server) RegisterRoutes() http.Handler {
|
||||
r := gin.Default()
|
||||
r.Use(cors.New(cors.Config{
|
||||
AllowOrigins: []string{"*"}, // or specific domains like "http://example.com"
|
||||
AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
|
||||
AllowHeaders: []string{"Origin", "Content-Type"},
|
||||
AllowCredentials: true,
|
||||
}))
|
||||
|
||||
r.GET("/", s.HelloWorldHandler)
|
||||
r.GET("/health", s.healthHandler)
|
||||
|
||||
Reference in New Issue
Block a user