diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/main.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/backend/main.go b/backend/main.go index 0d22b80..9639b74 100644 --- a/backend/main.go +++ b/backend/main.go @@ -317,8 +317,13 @@ func main() { dbinfo := fmt.Sprintf("user=%s password=%s dbname=%s sslmode=disable", DB_USER, DB_PASSWORD, DB_NAME) db, err = sql.Open("postgres", dbinfo) - if err != nil || db.Ping() != nil { - fmt.Println("Error connecting to database") + if err != nil { + panic(err) + } + + err = db.Ping() + if err != nil { + panic(err) } http.HandleFunc("/recipes", RecipeList) |