naise_pos/main.go

33 lines
607 B
Go
Raw Normal View History

2023-03-07 18:52:37 +07:00
package main
import (
"database/sql"
"log"
"git.nochill.in/nochill/naice_pos/api"
db "git.nochill.in/nochill/naice_pos/db/sqlc"
_ "github.com/lib/pq"
)
const (
dbDriver = "postgres"
dbSource = "postgresql://postgres:awksed123@localhost:5432/nice_pos?sslmode=disable"
serverAddress = "0.0.0.0:8888"
)
func main() {
dbConn, err := sql.Open(dbDriver, dbSource)
if err != nil {
log.Fatal("cannot connect to db:", err)
}
store := db.NewStore(dbConn)
server := api.NewServer(store)
err = server.Start(serverAddress)
if err != nil {
log.Fatal("cannot start server: ", err)
}
}