Last active
September 29, 2019 12:30
-
-
Save yutakahashi114/f4ef513cb49087f4c6a039212d9c9901 to your computer and use it in GitHub Desktop.
This file contains 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
package infrastructure | |
import ( | |
"app/interfaces/controllers" | |
"github.com/gin-gonic/gin" | |
) | |
var Router *gin.Engine | |
func init() { | |
router := gin.Default() | |
userController := controllers.NewUserController(NewSqlHandler()) | |
api := router.Group("/api") | |
{ | |
api.POST("/users", func(c *gin.Context) { userController.Create(c) }) | |
api.GET("/users/:id", func(c *gin.Context) { userController.Show(c) }) | |
api.GET("/users", func(c *gin.Context) { userController.All(c) }) | |
} | |
Router = router | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment