|
|
@ -35,15 +35,16 @@ func runApp(host string) { |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//}),
|
|
|
|
//}),
|
|
|
|
http.Middleware( |
|
|
|
http.Middleware( |
|
|
|
cors.Cors(cors.WithHeader("Content-Type,X-Requested-With,Access-Control-Allow-Credentials,User-Agent,Content-Length,Authorization,token"))), |
|
|
|
cors.Cors()), |
|
|
|
) |
|
|
|
) |
|
|
|
route := hs.Route("/") |
|
|
|
route := hs.Route("/") |
|
|
|
route.POST("/api/v1/answer/addQuestion", func(ctx http.Context) error { |
|
|
|
route.GET("/api/v1/answer/listCategory", func(ctx http.Context) error { |
|
|
|
in := UserAddRequest{Name: "tom"} |
|
|
|
in := UserAddRequest{Name: "tom"} |
|
|
|
http.SetOperation(ctx, "/api/abc") |
|
|
|
http.SetOperation(ctx, "/api/abc") |
|
|
|
h := ctx.Middleware(func(ctx context.Context, a any) (any, error) { |
|
|
|
h := ctx.Middleware(func(ctx context.Context, a any) (any, error) { |
|
|
|
//tr, _ := transport.FromServerContext(ctx)
|
|
|
|
//tr, _ := transport.FromServerContext(ctx)
|
|
|
|
//return AddUser(ctx, a.(*UserAddRequest))
|
|
|
|
//return AddUser(ctx, a.(*UserAddRequest))
|
|
|
|
|
|
|
|
return &UserAddResponse{Id: "xxx"}, nil |
|
|
|
return nil, errors.New(400, "BAD", "a") |
|
|
|
return nil, errors.New(400, "BAD", "a") |
|
|
|
}) |
|
|
|
}) |
|
|
|
out, err := h(ctx, &in) |
|
|
|
out, err := h(ctx, &in) |
|
|
|