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.
 
 

24 lines
683 B

package main
import (
"fmt"
"git.diulo.com/mogfee/protoc-gen-kit/example/service"
"git.diulo.com/mogfee/protoc-gen-kit/log"
"git.diulo.com/mogfee/protoc-gen-kit/middleware"
"git.diulo.com/mogfee/protoc-gen-kit/pkg/xjson"
user "git.diulo.com/mogfee/protoc-gen-kit/proto/v1"
"github.com/gin-gonic/gin"
)
func main() {
gin.SetMode(gin.ReleaseMode)
app := gin.Default()
srv := service.UserService{}
app.GET("/user/:name", func(c *gin.Context) {
xjson.PrintData(c.FullPath())
})
logger := log.With(log.DefaultLogger)
user.RegisterUserHandler(app, &srv, middleware.Logger(logger), middleware.Validate())
fmt.Println("http://localhost:8888")
app.Run("localhost:8888")
}