Git Product home page Git Product logo

Comments (9)

Estelle00 avatar Estelle00 commented on May 12, 2024

http://easy-mock.com/docs#xiang-ying-shi-shu-ju

from easy-mock.

my9074 avatar my9074 commented on May 12, 2024

@Estelle00 没太明白。你的意思是通过 _req 参数,自己做逻辑的判断?
但是在返回的 body 里去做这个逻辑,感觉很奇怪。

from easy-mock.

chuangker avatar chuangker commented on May 12, 2024

@my9074 不太明白你的意思?预览仅仅只是调用接口而已,调用接口传递参数不是很正常的事情吗?
你说的 指定 body 中的字段,是指提供类似的文档说明吧?

from easy-mock.

my9074 avatar my9074 commented on May 12, 2024

@chuangker 类似提供文档说明吧~可能我表达的不太清楚。
我的意思是正常前后端并行开发的时候,为了保证接口的正确性,光靠口头约定、邮件、文档等方式都不是很靠谱。所以需要事先定义好接口的规范,这些规范包括:

  • 描述等基本信息
  • 接口地址
  • 请求头
  • 请求参数: 参数的名称、类型、默认值等
  • 响应头
  • 响应参数: 参数的名称、类型、默认值等
    对于前端来说,有了这些信息就可以在代码中调用接口了。

但是现在我从现在的接口文档 只能看到接口地址,描述,HTTP 方法等信息。不是很全,不能做到前端只按照这份文档就能干活的目的。

from easy-mock.

aoao-eth avatar aoao-eth commented on May 12, 2024

我来说明一下:

  1. 这些功能都可以做的,但是不太符合我们的定位,所以没有做,有想法可以提 PR 来完成这些功能哈。
  2. 为什么不符合定位,我们的定位是mock数据,不是负责管理接口,mock数据需要的元素主要是接口路径和返回的数据。
  3. 那通过什么管理接口?我们推荐用swagger,在我们公司内部,服务端在代码里写注释,然后用注释生成swagger文档,swagger是一个接口管理(包括完整的参数和返回值等)和模拟操作的服务,然后通过swagger的链接,可以自动生成easy-mock的项目,这里mock扮演的只是最后一步可以模拟数据的角色。推荐用类似的方式结合成熟的方案来使用。

from easy-mock.

my9074 avatar my9074 commented on May 12, 2024

@xinyu198736 明白了~定位不同。
服务端在代码里写注释,然后用注释生成swagger文档 Node 框架中有现成的方案参考吗?

from easy-mock.

aoao-eth avatar aoao-eth commented on May 12, 2024

@my9074 http://zhuanlan.51cto.com/art/201706/542900.htm 可以参考下这个

from easy-mock.

my9074 avatar my9074 commented on May 12, 2024

多谢~

from easy-mock.

xieliangji avatar xieliangji commented on May 12, 2024

请问一下,我springboot的项目用resttemplate给easymock定义的的接口发送请求,为什么会出现两次同样的请求,但是两次请求的响应数据不一样,第一次是带html、css、js等的页面代码数据,第二次才是我定义的接口数据

from easy-mock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.