Created
December 30, 2022 23:08
-
-
Save dipeshhkc/8ccd474541861eff41803b9af1de3925 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SetupRoutes : gin router | |
func SetupRoutes() { | |
httpRouter := gin.Default() | |
//handling CORS | |
httpRouter.Use(cors.New(cors.Config{ | |
AllowOrigins: []string{"*"}, | |
AllowMethods: []string{"PUT", "PATCH", "GET", "POST", "OPTIONS", "DELETE"}, | |
AllowHeaders: []string{"*"}, | |
AllowCredentials: true, | |
})) | |
httpRouter.GET("/", func(c *gin.Context) { | |
c.JSON(http.StatusOK, gin.H{"data": "Golang RabbitMQ API 📺 Up and Running"}) | |
}) | |
httpRouter.POST("task1", controller.Task1Controller) | |
httpRouter.POST("task2", controller.Task2Controller) | |
httpRouter.Run(constants.SERVERPORT) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment