fusenapi/server/data-transfer/data-transfer.go
2023-09-19 11:41:38 +08:00

33 lines
700 B
Go

package main
import (
"flag"
"fmt"
config2 "fusenapi/server/data-transfer/internal/config"
handler2 "fusenapi/server/data-transfer/internal/handler"
svc2 "fusenapi/server/data-transfer/internal/svc"
"fusenapi/utils/auth"
"net/http"
"github.com/zeromicro/go-zero/rest"
)
var configFile = flag.String("f", "etc/data-transfer.yaml", "the config file")
func main() {
flag.Parse()
var c config2.Config
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {
}))
defer server.Stop()
ctx := svc2.NewServiceContext(c)
handler2.RegisterHandlers(server, ctx)
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
server.Start()
}