menu baru
This commit is contained in:
No files matched your search
@@ -8,11 +8,25 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
LoginHandler "template_blueprint/pkg/handlers/login"
|
||||
MenuHandler "template_blueprint/pkg/handlers/menu"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (s *Server) RegisterRoutes() http.Handler {
|
||||
r := gin.Default()
|
||||
//r.Use(cors.New(cors.Config{
|
||||
// AllowOrigins: []string{"*"}, // Sesuaikan dengan FE Nuxt
|
||||
// AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
|
||||
// AllowHeaders: []string{"Origin", "Content-Type", "Accept", "Authorization"},
|
||||
// AllowCredentials: true,
|
||||
// MaxAge: 12 * time.Hour,
|
||||
//}))
|
||||
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)
|
||||
|
||||
@@ -24,13 +38,27 @@ func (s *Server) RegisterRoutes() http.Handler {
|
||||
login.GET("/get", LoginHandler.Getlogin)
|
||||
login.GET("/:id", LoginHandler.GetloginbyID)
|
||||
}
|
||||
keuangan := api.Group("/menu")
|
||||
{
|
||||
keuangan.GET("/getlist", MenuHandler.Getmenukeuangan)
|
||||
keuangan.GET("/role", MenuHandler.Getrole)
|
||||
keuangan.GET("/role/type/:id", MenuHandler.GetroleByType)
|
||||
keuangan.GET("/id/:id", MenuHandler.GetmenuByID)
|
||||
keuangan.GET("/typeuser/id/:id", MenuHandler.GettypeByID)
|
||||
keuangan.GET("/type/:id", MenuHandler.GetroleByTypeWithUserInfo)
|
||||
keuangan.GET("/type", MenuHandler.Gettype)
|
||||
//keuangan.DELETE("/delete/:id", MenuHandler.GetBytypeIDdelete)
|
||||
//keuangan.POST("/role/insert", MenuHandler.InsertRoles)
|
||||
keuangan.POST("/update/rolemenu", MenuHandler.GabunganApi)
|
||||
}
|
||||
|
||||
r.Use(cors.New(cors.Config{
|
||||
AllowOrigins: []string{"*"}, // or specific domains like "http://example.com"
|
||||
AllowMethods: []string{"GET", "POST", "PUT", "DELETE"},
|
||||
AllowHeaders: []string{"Origin", "Content-Type"},
|
||||
AllowCredentials: true,
|
||||
}))
|
||||
// Contoh route
|
||||
r.GET("/api/test", func(c *gin.Context) {
|
||||
c.JSON(200, gin.H{"message": "CORS berhasil"})
|
||||
})
|
||||
|
||||
// Start server
|
||||
r.Run(":8080")
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user