Moco使用简单指导
需要java运行环境支持。下载jar包:moco-runner-<version>-standalone.jar
下面是参考:
配置
Moco的配置文件格式使用的是json。例如:
[ { "response" : { "text" : "Hello, Moco" } } ]
请求响应配置
{ "request" : { "uri" : "/foo" }, "response" : { "text" : "bar" } }
多文件配置
[ { "include" : "foo.json" }, { "include" : "bar.json" } ]
其中,foo.json和bar.json都是包含服务的配置文件。启动参数必须使用-g。
[ { "request": { "method": "post", "uri": "/tenants/login", "forms": { "email": "guiyun.wei@pekall.com", "password": "123" } }, "response": { "json": { "status": 0, "uid": 1 } } }, { "request": { "method": "post", "uri": "/tenants/login", "forms": { "email": "guiyun.wei@pekall.com", "password": "1234" } }, "response": { "json": { "status": 1 } } }, { "request": { "method": "post", "uri": "/tenants/logout", "forms": { "email": "guiyun.wei@pekall.com" } }, "response": { "json": { "status": 0 } } } ]
------------------------------------------------------------------------------------------------------------------------------------------
需要荷兰版牛栏、荷兰美素、母婴用品的攻城师、设计师朋友,欢迎关顾【七彩母婴店】【http://qicaoyun.taobao.com】。凡是从博客园得知信息的,全店商品,均可优惠,请告知客服哦。你也可以通过淘代码【D5867219】,在淘宝搜索到我们。收藏有礼哦!