This repository has been archived on 2026-03-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
api/main.go
2022-12-17 00:11:33 +01:00

28 lines
451 B
Go

package main
import (
"os"
"github.com/joho/godotenv"
"gorm.io/driver/postgres"
"gorm.io/gorm"
)
func main() {
//line valid only on dev. ignore
godotenv.Load("local.env")
//database connection
db, err := gorm.Open(postgres.Open(os.Getenv("DATABASE_URL")), &gorm.Config{})
if err != nil {
panic("failed to connect database")
}
db.AutoMigrate(&Quote{},
&QuoteLine{})
//Init api
router := InitRouter()
err = router.Run(":2021")
}