Sets up internal packages for database and api
This commit is contained in:
parent
b059fa25cb
commit
d82a1c9215
4 changed files with 15 additions and 15 deletions
8
main.go
8
main.go
|
|
@ -2,8 +2,8 @@ package main
|
|||
|
||||
import (
|
||||
_ "embed"
|
||||
"freed/api"
|
||||
"freed/database"
|
||||
"freed/internal/api"
|
||||
"freed/internal/database"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
|
|
@ -19,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")
|
||||
}
|
||||
|
||||
repository, err := database.NewRepository(dbFile)
|
||||
db, err := database.Connect(dbFile)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Could not initialize database: %v", err)
|
||||
|
|
@ -31,7 +31,7 @@ func main() {
|
|||
app.Use(logger.New())
|
||||
|
||||
// Try to set up API routes
|
||||
if err := api.Setup(app, repository); err != nil {
|
||||
if err := api.Setup(app, db); err != nil {
|
||||
log.Printf("Could not setup /api routes: %s", err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue