This commit is contained in:
Fran Jurmanović
2021-05-06 20:09:29 +02:00
parent 3a5138eb83
commit 20894ee42e
18 changed files with 197 additions and 28 deletions

View File

@@ -1,9 +1,25 @@
package main
import (
"os"
"wallet-api/pkg/api"
"wallet-api/pkg/utl/common"
"wallet-api/pkg/utl/db"
"wallet-api/pkg/utl/server"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
)
func main() {
server.Start()
err := godotenv.Load()
common.CheckError(err)
dbUrl := os.Getenv("DATABASE_URL")
r := gin.Default()
conn := db.CreateConnection(dbUrl)
api.Init(r, conn)
server.Start(r)
}

View File

@@ -0,0 +1,23 @@
package main
import (
"log"
"os"
"wallet-api/pkg/migrate"
"wallet-api/pkg/utl/db"
"github.com/joho/godotenv"
)
func main() {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
dbUrl := os.Getenv("DATABASE_URL")
conn := db.CreateConnection(dbUrl)
migrate.Start(conn)
}