Feature bookstore update (#253)

* update bookstore

* update bookstore
This commit is contained in:
songmeizi
2020-12-08 22:36:48 +08:00
committed by GitHub
parent 4d53045c6b
commit b060867009
26 changed files with 702 additions and 506 deletions

View File

@@ -10,7 +10,7 @@ import (
"github.com/tal-tech/go-zero/rest/httpx"
)
func addHandler(ctx *svc.ServiceContext) http.HandlerFunc {
func AddHandler(ctx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AddReq
if err := httpx.Parse(r, &req); err != nil {

View File

@@ -10,7 +10,7 @@ import (
"github.com/tal-tech/go-zero/rest/httpx"
)
func checkHandler(ctx *svc.ServiceContext) http.HandlerFunc {
func CheckHandler(ctx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CheckReq
if err := httpx.Parse(r, &req); err != nil {

View File

@@ -10,16 +10,18 @@ import (
)
func RegisterHandlers(engine *rest.Server, serverCtx *svc.ServiceContext) {
engine.AddRoutes([]rest.Route{
{
Method: http.MethodGet,
Path: "/add",
Handler: addHandler(serverCtx),
engine.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/add",
Handler: AddHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/check",
Handler: CheckHandler(serverCtx),
},
},
{
Method: http.MethodGet,
Path: "/check",
Handler: checkHandler(serverCtx),
},
})
)
}