refactor ngin to rest

This commit is contained in:
kim
2020-07-31 17:03:19 +08:00
parent b73684d9a6
commit cf8e0a118f
10 changed files with 34 additions and 37 deletions

View File

@@ -1,7 +1,7 @@
package config
import "zero/rest"
import "zero/ngin"
type Config struct {
rest.RestConf
ngin.NgConf
}

View File

@@ -4,7 +4,7 @@ import (
"flag"
"zero/core/conf"
"zero/rest"
"zero/ngin"
"zero/tools/goctl/api/demo/config"
"zero/tools/goctl/api/demo/handler"
)
@@ -17,7 +17,7 @@ func main() {
var c config.Config
conf.MustLoad(*configFile, &c)
engine := rest.MustNewServer(c.RestConf)
engine := ngin.MustNewEngine(c.NgConf)
defer engine.Stop()
handler.RegisterHandlers(engine)

View File

@@ -3,7 +3,7 @@ package handler
import (
"net/http"
"zero/rest/httpx"
"zero/ngin/httpx"
)
type (

View File

@@ -3,11 +3,11 @@ package handler
import (
"net/http"
"zero/rest"
"zero/ngin"
)
func RegisterHandlers(engine *rest.Server) {
engine.AddRoutes([]rest.Route{
func RegisterHandlers(engine *ngin.Engine) {
engine.AddRoutes([]ngin.Route{
{
Method: http.MethodGet,
Path: "/",