Comments (7)
前后端约定好封装格式,写一个接口文件可以全局用。
from easyhttp.
前后端约定好封装格式,写一个接口文件可以全局用。
但是不同的接口肯定要写多个文件的,比如登录注册这块,之前用retrofit的时候只需要创建一个LogReg_Interface就行了,里面包含多个接口,但是这个库一个接口就需要创建一个接口文件,每个接口传的参数不可能一样的,所以没法全局用一个文件呀
from easyhttp.
from easyhttp.
嘿嘿,我的意思是在前后端约定好封装的格式把数据封装在一个json里,不直接通过字段来请求,这样在调用接口的时候,只需要填parameter就可以。
from easyhttp.
把接口所有信息包装到一个类中,好处是维护起来方便,下次调用这个接口的时候不需要再去看后台文档,当后台接口有变动的时候,不需要一个个地方修改,只需要在这个类中修改就可以了
from easyhttp.
前期开发的优势并不大,后期维护才能展现魅力
from easyhttp.
我才理解你是不是想问怎么区分接口地址。。我的做法是服务端只暴露一个接口地址,移动端在接口文件里就只写这一个接口地址,那么服务端区分调用哪个接口的方法是根据移动端在header里边传的接口名或者新建一个字段用来传递调用哪个方法。
from easyhttp.
Related Issues (20)
- [疑惑]:为什么会出现多余的请求参数 HOT 5
- [Bug]:java.lang.ClassCastException: java.lang.Void cannot be cast to com.easy.demo.net.bean.HttpData HOT 8
- [疑惑]:关于easyHttp设置contentType,按照文档中的方法设置了,但是调用接口的时候还是会提示Content type 'application/x-www-form-urlencoded;charset=utf-8' not suppo HOT 1
- [疑惑]:是否有参数控制加载的时候 不出现加载动画? HOT 2
- [建议]:请求方式统一设置 HOT 8
- [Bug]:MMKV升级成1.3.2版本报错 HOT 7
- [Bug]:在AndroidProject Demo中搭配此库成功调用返回后,Object转型失败 HOT 1
- [疑惑]:业务场景:服务器双token形式,access_token失效了服务器会从接口返回新的access_token,客户端保存后要再次调用该接口获取数据 HOT 1
- [疑惑]:为啥不用OKhttp自带的okhttp3.Interceptor HOT 5
- [建议]:希望增加每个http请求可以自定义输入日志。 HOT 3
- [疑惑]:处理后台返回来的数据,想按String的类型来返回。 HOT 3
- [疑惑]:okhttp能够使用最新版本(4.x.x)吗? HOT 2
- [Bug]:读取缓存失败 HOT 2
- [Bug]:读取缓存失败 HOT 3
- [疑惑]:请教下,我们的框架上传文件支持文件file和参数一起上传吗 HOT 3
- [建议]:newWebSocket HOT 1
- [疑惑]:请问使用128位加密请求接口,请文在哪进行拦截 ,使用的框架版本是10.2 HOT 1
- [疑惑]:请求数据接口加密和接口返回数据解密在哪进行拦截? HOT 3
- [疑惑]:异步HTTP请求完成后如何渲染数据 HOT 2
- [疑惑]:其实不用传入setLifecycleOwner对象的 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easyhttp.