32 lines
605 B
Go
32 lines
605 B
Go
package main
|
|
|
|
import (
|
|
"database/sql"
|
|
"log"
|
|
|
|
"git.nochill.in/nochill/naice_pos/api"
|
|
db "git.nochill.in/nochill/naice_pos/db/sqlc"
|
|
"git.nochill.in/nochill/naice_pos/util"
|
|
_ "github.com/lib/pq"
|
|
)
|
|
|
|
func main() {
|
|
config, err := util.LoadConfig(".")
|
|
if err != nil {
|
|
log.Fatal("cannot load config: ", err)
|
|
}
|
|
dbConn, err := sql.Open(config.DBDriver, config.DBSource)
|
|
if err != nil {
|
|
log.Fatal("cannot connect to db:", err)
|
|
}
|
|
|
|
store := db.NewStore(dbConn)
|
|
server := api.NewServer(store)
|
|
|
|
err = server.Start(config.ServerAddress)
|
|
if err != nil {
|
|
log.Fatal("cannot start server: ", err)
|
|
}
|
|
|
|
}
|