29 lines
576 B
Go
29 lines
576 B
Go
package routes
|
|
|
|
import (
|
|
"net/http"
|
|
"zardzul/music-index/handlers"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func Routes(router *gin.Engine, userHandler *handlers.UserHandler, artistHandler *handlers.ArtistHandler) {
|
|
root := router.Group("/")
|
|
{
|
|
root.GET("/ping", func(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{"message": "pong"})
|
|
})
|
|
}
|
|
|
|
user := root.Group("/user")
|
|
{
|
|
user.POST("/create", userHandler.CreateUser)
|
|
user.GET("/getUserNameByID/:id", userHandler.GetUsernameByID)
|
|
}
|
|
|
|
artist := root.Group("/artist")
|
|
{
|
|
artist.GET("/getAll", artistHandler.GetAll)
|
|
}
|
|
}
|