transfer_rs/cmd/api/transfer.go

31 lines
641 B
Go
Executable File

package main
import (
"flag"
"fmt"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/rest"
_ "github.com/zeromicro/zero-contrib/zrpc/registry/nacos"
"rs/cmd/api/internal/config"
"rs/cmd/api/internal/handler"
"rs/cmd/api/internal/svc"
)
var configFile = flag.String("f", "etc/transfer.yaml", "the config file")
func main() {
flag.Parse()
var c config.Config
conf.MustLoad(*configFile, &c)
server := rest.MustNewServer(c.RestConf)
defer server.Stop()
ctx := svc.NewServiceContext(c)
handler.RegisterHandlers(server, ctx)
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
server.Start()
}