Code Monkey home page Code Monkey logo

mockserver's Issues

使用mockjs中 dataImage报错

{
"array|1-10": [
1,
2,
3
],
"boolean": true,
"null": null,
"number": 123,
"object": {
"a": "b",
"c": "d",
"e": "f"
},
"url": "@image",
"string": "Hello World"
}

url为@image 可以,换为 @dataimage则 接口提示

Internal Server Error
module.require is not a function

是否可以在项目里面归类接口

DESC

当项目接口太多的时候 添加的接口全部都归类在一起 每次需要搜索 对于模块化管理不是很方便

ENV

Platform:

Node.js Version:

mockserver Version:

Ace编辑器是不是有bug呀

  1. Ace编辑器没法正常输入
  2. 现在ace给出的版本,好像也没有分codeEditor以及treeEditor,而且个人觉得一个其实也挺好的,详情:https://github.com/josdejong/jsoneditor/blob/master/examples/08_custom_ace.html
  3. 作者怎么处理post请求的?好像模拟起来结果还是get请求。难道只能实现返回写死的数据?可以不可以获取post请求里的数据,在返回项中对这些数据做些处理,然后再返回
  4. 现在api管理的软件感觉很多呀,比如postman还有swaggerUI,感觉软件可以专注mock,那些接口描述的输入是不是可以去掉?

初始化数据库失败?

初始化数据库提示
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: YES)

数据库版本 5.7.17

连续调用同一个接口,只有第一次成功,其余都报错

DESC

我连续调用了同一个接口,发现只有第一次成功,其余2次都报错了

api.getMyInfo()  // 请求了一个mockserver地址
api.getMyInfo()
api.getMyInfo()

报错信息如下:

5|developm | [2017-12-06 17:37:50] [Error] SyntaxError: Unexpected token o in JSON at position 1
5|developm |     at Object.parse (native)
5|developm |     at _class._callee$ (/Users/wangyazhou/code/github/mockserver/src/api/controller/index.js:90:41)
5|developm |     at tryCatch (/Users/wangyazhou/code/github/mockserver/node_modules/regenerator-runtime/runtime.js:65:40)
5|developm |     at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/wangyazhou/code/github/mockserver/node_modules/regenerator-runtime/runtime.js:299:22)
5|developm |     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/wangyazhou/code/github/mockserver/node_modules/regenerator-runtime/runtime.js:117:21)
5|developm |     at step (/Users/wangyazhou/code/github/mockserver/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
5|developm |     at /Users/wangyazhou/code/github/mockserver/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
5|developm | [2017-12-06 17:37:50] [Error] SyntaxError: Unexpected token o in JSON at position 1
5|developm |     at Object.parse (native)
5|developm |     at _class._callee$ (/Users/wangyazhou/code/github/mockserver/src/api/controller/index.js:90:41)
5|developm |     at tryCatch (/Users/wangyazhou/code/github/mockserver/node_modules/regenerator-runtime/runtime.js:65:40)
5|developm |     at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/wangyazhou/code/github/mockserver/node_modules/regenerator-runtime/runtime.js:299:22)
5|developm |     at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/wangyazhou/code/github/mockserver/node_modules/regenerator-runtime/runtime.js:117:21)
5|developm |     at step (/Users/wangyazhou/code/github/mockserver/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
5|developm |     at /Users/wangyazhou/code/github/mockserver/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13

ENV

Platform: mac pro

Node.js Version: v6.11.5

mockserver Version: 2.3.2

感觉跑起来比较难...

DESC

门槛较高.要安装mysql

且需要跨域访问时,还得自己配nginx

我期望像json-server那样使用简单的mock服务器,但json-server太简单了,少了很多配置.

还有就是对于mock服务器来说,跨域访问是基本需求,我期望在这方面不要搞的太复杂.nodejs自身实现跨域访问和代理都不算难, http-proxy-middleware, hapi的h2o2, json-server都实现过.

抱歉我并没有尝试跑一下这个项目,主要是感觉使用方式和其他的很不一样,所以打了退堂鼓.如果有什么我说错了的,期望不要介意.

ENV

Platform:

Node.js Version:

mockserver Version:

关于“只匹配【?】前部分” 不行的问题修复

修改了src/api/controller/index.js第25行。
由原来的
const tempdata = await this.model('mockserver').where("api_url regexp '^" + url + "\\?'").select();
改成
const tempdata = await this.model('mockserver').where("api_url regexp '^" + url + "\?'").select();

使用过程遇到问题,求解答

npm install之后,需要连接数据库mysql的目的是什么啊?这一步是必须的吗?
npm start后,没有出现截图中的界面是为什么啊?

能支持swagger嘛?

比如工作中用到的是机遇swagger生成的api文档,支持解析swagger格式的API文档并生成模拟的路由及数据功能吗?

请问作者这个要怎么配置才能访问到

添加了接口
但是我在react里面
let data =await axios.post('http://127.0.0.1:8033/ff30d02a10c33f09e86b/api/user/login',{
params:{
account:this.state.account,
password:this.state.password
}
}).then(data=>{
return data;
});
返回提示{code: "ETIMEDOUT", errno: "ETIMEDOUT", syscall: "connect", address: "47.93.62.181", port: 8034}
address
:
"47.93.62.181"
code
:
"ETIMEDOUT"
errno
:
"ETIMEDOUT"
port
:
8034
syscall
:
"connect"
errorMessage
:
"Get data is failed,API dose not exist or parameters are error,may be you should send some parameters to proxy URL"
proxyUrl
:
"http://47.93.62.181:8034//api/user/login"
我关闭了二次代理的啊

懒得(buhui)发PR 留到这里

这个东西我觉得非常适合我用,感谢作者,只不过为了方便弄个docker部署,方便大家搭建
把下面两个文件放到更目录
docker-compose up -d 就可以

docker-compose.yaml

version: '2'
services:
  woodyapi:
    build: .
    ports:
      - "8033:8033"
    volumes:
      - ./:/root/mock
    depends_on:
      - db
  db:
    image: mysql:5.5
    environment:
      - MYSQL_ROOT_PASSWORD=123456
      - MYSQL_USER=mysql
      - MYSQL_PASSWORD=mysql
      - MYSQL_DATABASE=mysql

Dockerfile

FROM node
WORKDIR /root/mock
RUN npm install
CMD ["npm", "start"]

二次代理

请问你这个系统怎么处理二次代理的接口的登录问题?

请求的参数进行校验

DESC

提一个需求吧

希望客户端在请求数据的时候 mock返回数据之前 要与数据库中BODY进行参数对比

ENV

Platform:

Node.js Version:

mockserver Version:

这个遮罩层怎么实现的?

DESC

添加接口的loading遮罩层没找到在哪里实现的,可否告知,另外项目不升级到thinkjs3吗,和v2差别挺大,一些方法都废除了!

ENV

Platform:

Node.js Version:

mockserver Version:

关于URL正则匹配的一点疑问

现在我有两个接口:

A : /api/a? 匹配模式为只匹配?前面部分

B: /api/abc? 匹配模式为只匹配?前面部分

这个时候我只访问/api/a?是正常的,但如果访问/api/a?page=1,则会提示有多个接口使用了此路径

我再增加一个接口

C: /api/a/:id 匹配模式为精确匹配,并删除接口B,再访问/api/a?page=1,则会提示获取数据错误,可能是接口不存在,或参数错误,错误信息

我已经在线上DEOM上添加了类似接口,烦请作者可以测试一下。

另本地在类似场景下得到的SQL结果如下

1

作者的语言切换功能

DESC

在找postman时找到你的作品,发现语言切换功能能6,想请教一下是怎么实现的

ENV

Platform:

Node.js Version:

mockserver Version:

docker环境下无法连接数据库的问题

DESC

docker环境下当访问数据库的时候不管怎么填地址,都提示

Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'172.21.0.3' (using password: YES)

之类的错误,网上说node-mysql的版本问题. 可是我换有些电脑又可以,玄,留个issues,期待后续人员解决, 感谢作者的无私贡献,项目正是我想要的

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.