用户管理之客户端与服务器端

2019-11-06  本文已影响0人  jddxs

1、客户端

使用Nohttp库发起Http请求

2、服务端

使用Nancy.Hosting.Self库处理Http请求

2.1、路由

把URL与处理器对应起来,或者说寻找为URL的处理器。
得到参数,例如请求是:http://localhost:1234/user/1?name=deng
,则获取参数代码如下:

           Get("/user/{id}", (parameters) =>
            {
                var name = Request.Query.name;
                var path = Request.Url.Path;
                return $"Hello 你访问了{path},参数是name={name}";
            });

2.2、处理post请求

上一篇 下一篇

猜你喜欢

热点阅读