You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
526 B
Go
28 lines
526 B
Go
package main
|
|
|
|
import (
|
|
"bookstore/api/internal/config"
|
|
"bookstore/api/internal/handler"
|
|
"bookstore/api/internal/svc"
|
|
"flag"
|
|
|
|
"github.com/tal-tech/go-zero/core/conf"
|
|
"github.com/tal-tech/go-zero/rest"
|
|
)
|
|
|
|
var configFile = flag.String("f", "etc/bookstore-api.yaml", "the config file")
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
|
|
var c config.Config
|
|
conf.MustLoad(*configFile, &c)
|
|
|
|
ctx := svc.NewServiceContext(c)
|
|
server := rest.MustNewServer(c.RestConf)
|
|
defer server.Stop()
|
|
|
|
handler.RegisterHandlers(server, ctx)
|
|
server.Start()
|
|
}
|