rename ngin to rest
This commit is contained in:
@@ -6,6 +6,6 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
rest.RtConf
|
||||
rest.RestConf
|
||||
Rpc rpcx.RpcClientConf
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ func main() {
|
||||
Client: client,
|
||||
}
|
||||
|
||||
engine := rest.MustNewEngine(c.RtConf)
|
||||
engine := rest.MustNewServer(c.RestConf)
|
||||
defer engine.Stop()
|
||||
|
||||
handler.RegisterHandlers(engine, ctx)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"zero/rest"
|
||||
)
|
||||
|
||||
func RegisterHandlers(engine *rest.Engine, ctx *svc.ServiceContext) {
|
||||
func RegisterHandlers(engine *rest.Server, ctx *svc.ServiceContext) {
|
||||
engine.AddRoutes([]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
|
||||
@@ -6,6 +6,6 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
rest.RtConf
|
||||
rest.RestConf
|
||||
Rpc rpcx.RpcClientConf
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ func main() {
|
||||
Client: client,
|
||||
}
|
||||
|
||||
engine := rest.MustNewEngine(c.RtConf)
|
||||
engine := rest.MustNewServer(c.RestConf)
|
||||
defer engine.Stop()
|
||||
|
||||
handler.RegisterHandlers(engine, ctx)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"zero/rest"
|
||||
)
|
||||
|
||||
func RegisterHandlers(engine *rest.Engine, ctx *svc.ServiceContext) {
|
||||
func RegisterHandlers(engine *rest.Server, ctx *svc.ServiceContext) {
|
||||
engine.AddRoutes([]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
func main() {
|
||||
logx.Disable()
|
||||
stat.SetReporter(nil)
|
||||
server := rest.MustNewEngine(rest.RtConf{
|
||||
server := rest.MustNewServer(rest.RestConf{
|
||||
ServiceConf: service.ServiceConf{
|
||||
Name: "breaker",
|
||||
Log: logx.LogConf{
|
||||
|
||||
@@ -47,7 +47,7 @@ func handle(w http.ResponseWriter, r *http.Request) {
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
engine := rest.MustNewEngine(rest.RtConf{
|
||||
engine := rest.MustNewServer(rest.RestConf{
|
||||
ServiceConf: service.ServiceConf{
|
||||
Log: logx.LogConf{
|
||||
Mode: "console",
|
||||
|
||||
@@ -37,7 +37,7 @@ func handlePost(w http.ResponseWriter, r *http.Request) {
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
engine := rest.MustNewEngine(rest.RtConf{
|
||||
engine := rest.MustNewServer(rest.RestConf{
|
||||
ServiceConf: service.ServiceConf{
|
||||
Log: logx.LogConf{
|
||||
Mode: "console",
|
||||
|
||||
@@ -42,7 +42,7 @@ func main() {
|
||||
flag.Parse()
|
||||
|
||||
logx.Disable()
|
||||
engine := rest.MustNewEngine(rest.RtConf{
|
||||
engine := rest.MustNewServer(rest.RestConf{
|
||||
ServiceConf: service.ServiceConf{
|
||||
Log: logx.LogConf{
|
||||
Mode: "console",
|
||||
|
||||
@@ -31,7 +31,7 @@ func handle(w http.ResponseWriter, r *http.Request) {
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
engine := rest.MustNewEngine(rest.RtConf{
|
||||
engine := rest.MustNewServer(rest.RestConf{
|
||||
ServiceConf: service.ServiceConf{
|
||||
Log: logx.LogConf{
|
||||
Path: "logs",
|
||||
|
||||
@@ -20,7 +20,7 @@ const jwtUserField = "user"
|
||||
|
||||
type (
|
||||
Config struct {
|
||||
rest.RtConf
|
||||
rest.RestConf
|
||||
AccessSecret string
|
||||
AccessExpire int64 `json:",default=1209600"` // 2 weeks
|
||||
RefreshSecret string
|
||||
@@ -79,7 +79,7 @@ func main() {
|
||||
var c Config
|
||||
conf.MustLoad("user.json", &c)
|
||||
|
||||
engine, err := rest.NewEngine(c.RtConf)
|
||||
engine, err := rest.NewServer(c.RestConf)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ func main() {
|
||||
}()
|
||||
|
||||
logx.Disable()
|
||||
engine := rest.MustNewEngine(rest.RtConf{
|
||||
engine := rest.MustNewServer(rest.RestConf{
|
||||
ServiceConf: service.ServiceConf{
|
||||
Log: logx.LogConf{
|
||||
Mode: "console",
|
||||
|
||||
@@ -42,7 +42,7 @@ func main() {
|
||||
var c rpcx.RpcClientConf
|
||||
conf.MustLoad(*configFile, &c)
|
||||
client = rpcx.MustNewClient(c)
|
||||
engine := rest.MustNewEngine(rest.RtConf{
|
||||
engine := rest.MustNewServer(rest.RestConf{
|
||||
ServiceConf: service.ServiceConf{
|
||||
Log: logx.LogConf{
|
||||
Mode: "console",
|
||||
|
||||
Reference in New Issue
Block a user