Add initial database setup and user/artist management functionality

This commit is contained in:
zardzul
2026-03-13 20:42:50 +01:00
parent 5fa23b0d1c
commit f81b28417e
26 changed files with 585 additions and 64 deletions
+26 -1
View File
@@ -1,5 +1,30 @@
package main
import (
"zardzul/music-index/database"
"zardzul/music-index/handlers"
"zardzul/music-index/repository"
"zardzul/music-index/routes"
"github.com/gin-gonic/gin"
)
func main() {
pool, queries, databaseError := database.Connect()
if databaseError != nil {
panic(databaseError)
}
defer pool.Close()
userRepo := repository.NewUserRepository(queries)
userHandler := handlers.NewUserHandler(userRepo)
artistRepo := repository.NewArtistRepository(queries)
artistHandler := handlers.NewArtistHandler(artistRepo)
router := gin.Default()
routes.Routes(router, userHandler, artistHandler)
if routerError := router.Run(":8080"); routerError != nil {
panic(routerError)
}
}