ADD: added initial page with login
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
_ "github.com/lib/pq" // Import the PostgreSQL driver
|
||||
)
|
||||
|
||||
type database struct {
|
||||
@@ -35,12 +37,14 @@ func (d *database) Connect() error {
|
||||
db, err := sql.Open("postgres", psqlInfo)
|
||||
// Open a new database connection
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open database: %w", err)
|
||||
panic("failed to open database: " + err.Error())
|
||||
// return fmt.Errorf("failed to open database: %w", err)
|
||||
}
|
||||
|
||||
// Test the connection
|
||||
if err := db.Ping(); err != nil {
|
||||
return fmt.Errorf("failed to ping database: %w", err)
|
||||
panic("failed to ping database: " + err.Error())
|
||||
// return fmt.Errorf("failed to ping database: %w", err)
|
||||
}
|
||||
|
||||
log.Println("Connected to the database successfully")
|
||||
|
||||
Reference in New Issue
Block a user