Comments (9)
http://easy-mock.com/docs#xiang-ying-shi-shu-ju
from easy-mock.
@Estelle00 没太明白。你的意思是通过 _req 参数,自己做逻辑的判断?
但是在返回的 body 里去做这个逻辑,感觉很奇怪。
from easy-mock.
@my9074 不太明白你的意思?预览仅仅只是调用接口而已,调用接口传递参数不是很正常的事情吗?
你说的 指定 body 中的字段
,是指提供类似的文档说明吧?
from easy-mock.
@chuangker 类似提供文档说明吧~可能我表达的不太清楚。
我的意思是正常前后端并行开发的时候,为了保证接口的正确性,光靠口头约定、邮件、文档等方式都不是很靠谱。所以需要事先定义好接口的规范,这些规范包括:
- 描述等基本信息
- 接口地址
- 请求头
- 请求参数: 参数的名称、类型、默认值等
- 响应头
- 响应参数: 参数的名称、类型、默认值等
对于前端来说,有了这些信息就可以在代码中调用接口了。
但是现在我从现在的接口文档 只能看到接口地址,描述,HTTP 方法等信息。不是很全,不能做到前端只按照这份文档就能干活的目的。
from easy-mock.
我来说明一下:
- 这些功能都可以做的,但是不太符合我们的定位,所以没有做,有想法可以提 PR 来完成这些功能哈。
- 为什么不符合定位,我们的定位是mock数据,不是负责管理接口,mock数据需要的元素主要是接口路径和返回的数据。
- 那通过什么管理接口?我们推荐用swagger,在我们公司内部,服务端在代码里写注释,然后用注释生成swagger文档,swagger是一个接口管理(包括完整的参数和返回值等)和模拟操作的服务,然后通过swagger的链接,可以自动生成easy-mock的项目,这里mock扮演的只是最后一步可以模拟数据的角色。推荐用类似的方式结合成熟的方案来使用。
from easy-mock.
@xinyu198736 明白了~定位不同。
服务端在代码里写注释,然后用注释生成swagger文档
Node 框架中有现成的方案参考吗?
from easy-mock.
@my9074 http://zhuanlan.51cto.com/art/201706/542900.htm 可以参考下这个
from easy-mock.
多谢~
from easy-mock.
请问一下,我springboot的项目用resttemplate给easymock定义的的接口发送请求,为什么会出现两次同样的请求,但是两次请求的响应数据不一样,第一次是带html、css、js等的页面代码数据,第二次才是我定义的接口数据
from easy-mock.
Related Issues (20)
- 公司内网部署,很多网址被屏蔽导致无法访问,需要如何解决 HOT 7
- [ioredis] Unhandled error event: Error: connect ETIMEDOUT
- mock服务搬到个人服务器上了 在线分流 mock.51y.cc:81 HOT 6
- 不能正常返回指定数目的数组元素 HOT 2
- 项目是不是不维护了啊
- 搭建easymock后,启动预览接口时,报错:Uncaught ReferenceError: hljs is not defined HOT 4
- 【工具分享】如果有从 easy-mock 导出的 zip 文件,可以使用这个工具来快速启动本地 mock 服务
- easy mock官网咋又502了,正在测试模拟数据呢 HOT 1
- http://em.sucaidaohang.com/ 分流easy-mock HOT 4
- easy-mock访问不了了 HOT 2
- 如何返回一个非200的状态,譬如400、500
- 有偿提供安装指导
- 帮助分流 https://mock.feup.cn 支持 https,每天自动备份数据,保障数据安全。
- 同步swagger提示证书过期
- 技术要求太高了。入门即放弃系列 HOT 6
- Assertion `(argc) == (4)' failed HOT 1
- 使用mock.js中的increment存在问题
- [nodemon] app crashed - waiting for file changes before starting
- docker安裝各种报错 HOT 2
- post方法如何加入请求参数 HOT 1
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 easy-mock.