小编Kam*_*kar的帖子

我们将验证逻辑放在 NodeJs MVC 中的哪里?

我将nodeJs应用程序分为MVC架构 模型控制器服务路由器工具日志 我的问题是我可以在服务层或控制器层中放置其余API的验证。我正在使用express 模块,并且我想使用express-validater 模块进行验证。哪一种方法更好?

model-view-controller node.js

6
推荐指数
2
解决办法
4059
查看次数

如何使用翻新发布(x-www-form-urlencoded)Json数据?

当我在正文中发布数据时(x-www-form-urlencoded),在Postman中可以正常工作。但是,使用Retrofit 2.0 Android无法正常工作。

@Headers("Content-Type: application/x-www-form-urlencoded")
@POST("/api/jsonws/pushUserData")
Call<ResponseBody>  pushData(@Body JSONObject jsonObj);

JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("role","owner");
            jsonObject.put("id","27001");

        } catch (JSONException e) {
            e.printStackTrace();
        }

        ApiInterface apiInterface1= ApiClient.getClientAuthentication().create(ApiInterface.class);
        Call<ResponseBody> responseBodyCall = apiInterface1.pushData(jsonObject);
Run Code Online (Sandbox Code Playgroud)

这段代码不起作用,我也尝试@FormUrlEncoded。

android json retrofit2

3
推荐指数
1
解决办法
3965
查看次数