Skip to content

Commit 726d96e

Browse files
adding database connection api
1 parent 0a0ae07 commit 726d96e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cmd/ecomm-api/main.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
package main
22

3+
import (
4+
"github.com/bloodgroup-cplusplus/ecomm/db"
5+
)
36
func main() {
4-
db.NewDatabase()
7+
db, err := db.NewDatabase()
8+
if err != nil {
9+
log.Fatal("Error opening database :%v",err)
10+
}
11+
defer db.Close()
12+
log.Prinln("Successfully connected to database")
13+
14+
// do something with the databawse
515
}
616

17+
18+
19+

0 commit comments

Comments
 (0)