You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
591 B

2 years ago
package main
import (
2 years ago
"flag"
2 years ago
"fmt"
2 years ago
"git.diulo.com/mogfee/kit"
2 years ago
user "git.diulo.com/mogfee/kit/api"
"git.diulo.com/mogfee/kit/example/service"
"git.diulo.com/mogfee/kit/middleware/jwt"
2 years ago
"git.diulo.com/mogfee/kit/transport/http"
2 years ago
)
func main() {
2 years ago
flag.Parse()
1 year ago
runApp("localhost:8080")
2 years ago
}
func runApp(host string) {
2 years ago
hs := http.NewServer(
2 years ago
http.Address(host),
1 year ago
http.Middleware(jwt.JWT(jwt.WithJwtKey("Jt6Zv!KTopXZ6S4C"))),
2 years ago
)
1 year ago
user.RegisterUserHTTPServer(hs, service.NewUserService("1234567890123456"))
app := kit.New(kit.Server(hs))
2 years ago
fmt.Println(app.Run())
fmt.Println(app.Stop())
}