mirror of
https://github.com/pyihe/go-pkg.git
synced 2025-10-24 00:14:05 +08:00
38 lines
602 B
Go
38 lines
602 B
Go
package main
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/pyihe/go-pkg/https/http_api"
|
|
"github.com/pyihe/go-pkg/tools"
|
|
)
|
|
|
|
type game struct {
|
|
}
|
|
|
|
func (g *game) Handle(r http_api.IRouter) {
|
|
r.GET("/get", http_api.WrapFunc(g.get))
|
|
}
|
|
|
|
func (g *game) get(c *gin.Context) (interface{}, error) {
|
|
//time.Sleep(10 * time.Second)
|
|
return 100, nil
|
|
}
|
|
|
|
func main() {
|
|
config := http_api.Config{
|
|
Name: "game",
|
|
Addr: ":8888",
|
|
RoutePrefix: "",
|
|
CertFile: "",
|
|
KeyFile: "",
|
|
}
|
|
s := http_api.NewHTTPServer(config)
|
|
defer s.Stop()
|
|
|
|
s.AddHandler(&game{})
|
|
|
|
s.Run()
|
|
|
|
tools.Wait()
|
|
}
|