Skip to content

Commit

Permalink
Add server entry point
Browse files Browse the repository at this point in the history
  • Loading branch information
Delavalom authored Oct 3, 2023
1 parent fc2bf34 commit 29bbc05
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package main

import (
"context"
"log"

"github.com/Delavalom/RBD/api"
db "github.com/Delavalom/RBD/db/sqlc"
"github.com/Delavalom/RBD/util"
"github.com/jackc/pgx/v5/pgxpool"
)

func main() {
config, err := util.LoadConfig(".")
if err != nil {
log.Fatal("cannot load config")
}
conn, err := pgxpool.New(context.Background(), config.DBSource)
if err != nil {
log.Fatal("cannot connect to db")
}

store := db.NewStore(conn)
server := api.NewServer(store)

if err != nil {
log.Fatal("cannot start server", err)
}

err = server.Start("0.0.0.0:8080")

}

0 comments on commit 29bbc05

Please sign in to comment.