create base structure

This commit is contained in:
Stanislaw
2022-12-24 00:45:54 +01:00
parent 31d4d055ac
commit 3f17d6e985
6 changed files with 66 additions and 57 deletions

15
main.go
View File

@@ -3,6 +3,9 @@ package main
import (
"os"
"gractwo-api/database"
"gractwo-api/router"
"github.com/joho/godotenv"
"gorm.io/driver/postgres"
"gorm.io/gorm"
@@ -17,11 +20,15 @@ func main() {
if err != nil {
panic("failed to connect database")
}
db.AutoMigrate(&Quote{},
&QuoteLine{})
db.AutoMigrate(
&database.Quote{},
&database.QuoteLine{},
&database.Image{})
//Init api
router := InitRouter()
router := router.InitRouter()
err = router.Run(":2021")
if err != nil {
panic("failed to connect database")
}
}