diff --git a/tools/goctl/api/demo/config/config.go b/tools/goctl/api/demo/config/config.go deleted file mode 100644 index 5beaa249..00000000 --- a/tools/goctl/api/demo/config/config.go +++ /dev/null @@ -1,7 +0,0 @@ -package config - -import "zero/ngin" - -type Config struct { - ngin.NgConf -} diff --git a/tools/goctl/api/demo/demo.go b/tools/goctl/api/demo/demo.go deleted file mode 100644 index 3c203a08..00000000 --- a/tools/goctl/api/demo/demo.go +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "flag" - - "zero/core/conf" - "zero/ngin" - "zero/tools/goctl/api/demo/config" - "zero/tools/goctl/api/demo/handler" -) - -var configFile = flag.String("f", "etc/user.json", "the config file") - -func main() { - flag.Parse() - - var c config.Config - conf.MustLoad(*configFile, &c) - - engine := ngin.MustNewEngine(c.NgConf) - defer engine.Stop() - - handler.RegisterHandlers(engine) - engine.Start() -} diff --git a/tools/goctl/api/demo/etc/user.json b/tools/goctl/api/demo/etc/user.json deleted file mode 100644 index cd52be6f..00000000 --- a/tools/goctl/api/demo/etc/user.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Name": "user", - "Host": "127.0.0.1", - "Port": 3333, - "Log": { - "Mode": "console" - } -} diff --git a/tools/goctl/api/demo/handler/getuserhandler.go b/tools/goctl/api/demo/handler/getuserhandler.go deleted file mode 100644 index 1baa717c..00000000 --- a/tools/goctl/api/demo/handler/getuserhandler.go +++ /dev/null @@ -1,33 +0,0 @@ -package handler - -import ( - "net/http" - - "zero/ngin/httpx" -) - -type ( - request struct { - User string `form:"user,optional"` - } - - response struct { - Code int `json:"code"` - Greet string `json:"greet"` - From string `json:"from,omitempty"` - } -) - -func GreetHandler(w http.ResponseWriter, r *http.Request) { - var req request - err := httpx.Parse(r, &req) - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - - httpx.OkJson(w, response{ - Code: 0, - Greet: "hello", - }) -} diff --git a/tools/goctl/api/demo/handler/handlers.go b/tools/goctl/api/demo/handler/handlers.go deleted file mode 100644 index 24e71299..00000000 --- a/tools/goctl/api/demo/handler/handlers.go +++ /dev/null @@ -1,17 +0,0 @@ -package handler - -import ( - "net/http" - - "zero/ngin" -) - -func RegisterHandlers(engine *ngin.Engine) { - engine.AddRoutes([]ngin.Route{ - { - Method: http.MethodGet, - Path: "/", - Handler: GreetHandler, - }, - }) -} diff --git a/tools/goctl/api/demo/svc/servicecontext.go b/tools/goctl/api/demo/svc/servicecontext.go deleted file mode 100644 index 51137699..00000000 --- a/tools/goctl/api/demo/svc/servicecontext.go +++ /dev/null @@ -1,4 +0,0 @@ -package svc - -type ServiceContext struct { -}