Adapts main.go to sqlc usage

This commit is contained in:
Dennis Schoepf 2024-04-26 22:47:01 +02:00
parent 5005186cd3
commit c2a27a0751
2 changed files with 14 additions and 4 deletions

View file

@ -1,8 +1,9 @@
package main
import (
"freed/internal/api"
"freed/internal/database"
_ "embed"
"freed/api"
"freed/database"
"log"
"os"
@ -18,7 +19,7 @@ func main() {
log.Fatalf("No ENV value set for 'DB_FILE', could not initialize database. Please provide a valid path and filename")
}
err := database.Connect(dbFile)
repository, err := database.NewRepository(dbFile)
if err != nil {
log.Fatalf("Could not initialize database: %v", err)
@ -30,7 +31,7 @@ func main() {
app.Use(logger.New())
// Try to set up API routes
if err := api.Setup(app); err != nil {
if err := api.Setup(app, repository); err != nil {
log.Printf("Could not setup /api routes: %s", err)
}