All Projects → ufologist → Puer Mock

ufologist / Puer Mock

Licence: mit
Puer + Mock.js = A configurable mock server with configurable mock(random) data.

Projects that are alternatives of or similar to Puer Mock

wiremock-junit5
Wiremock extension to inject server into JUnit5 tests
Stars: ✭ 43 (-91.35%)
Mutual labels:  mock-server
Mockman
Manage and start the mock servers on your local platform easily
Stars: ✭ 281 (-43.46%)
Mutual labels:  mock-server
Mocker Api
mocker-api that creates mocks for REST APIs. It will be helpful when you try to test your application without the actual REST API server.
Stars: ✭ 374 (-24.75%)
Mutual labels:  mock-server
justreq
A caching proxy server for testing interface of HTTP or HTTPS. A never offline testing interface server. A mock server
Stars: ✭ 15 (-96.98%)
Mutual labels:  mock-server
zmock
zmock--http接口的mock平台
Stars: ✭ 98 (-80.28%)
Mutual labels:  mock-server
Stubby4j
An HTTP stub server for testing application interactions with web services (REST, etc) & external system stubbing for easy testing
Stars: ✭ 300 (-39.64%)
Mutual labels:  mock-server
mocka
Mocka — A Mock Server Made for Developers by Developers, made in Swift ❤️
Stars: ✭ 56 (-88.73%)
Mutual labels:  mock-server
Wiremock
A tool for mocking HTTP services
Stars: ✭ 4,790 (+863.78%)
Mutual labels:  mock-server
Chn Eolinker Ams Lite 4.0 For Java
中国最大的API接口管理平台,3.x开源发行版,支持多国语言[英语、简体中文、繁体中文]
Stars: ✭ 275 (-44.67%)
Mutual labels:  mock-server
Mockttp
Powerful friendly HTTP mock server & proxy
Stars: ✭ 346 (-30.38%)
Mutual labels:  mock-server
speakeasy
A tool for creating Go web servers which can be embedded in iOS and Android apps.
Stars: ✭ 27 (-94.57%)
Mutual labels:  mock-server
mokker
The mock does not mock you. The video: https://www.youtube.com/watch?v=gGLNJpC-Ov0
Stars: ✭ 13 (-97.38%)
Mutual labels:  mock-server
Mockserver
MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and…
Stars: ✭ 3,479 (+600%)
Mutual labels:  mock-server
vuetibook
Integrating Vue.js, Vuetify and Storybook
Stars: ✭ 16 (-96.78%)
Mutual labels:  mock-server
Wiremock.net
WireMock.Net is a flexible library for stubbing and mocking web HTTP responses using request matching and response templating. Based on the functionality from http://WireMock.org, but extended with more functionality.
Stars: ✭ 408 (-17.91%)
Mutual labels:  mock-server
catbird
Mock server for UI tests
Stars: ✭ 32 (-93.56%)
Mutual labels:  mock-server
Vue Fullstack
vue fullstack template
Stars: ✭ 297 (-40.24%)
Mutual labels:  mock-server
Drakov
Mock Server that implements the API Blueprint specification
Stars: ✭ 467 (-6.04%)
Mutual labels:  mock-server
Smocker
Smocker is a simple and efficient HTTP mock server and proxy.
Stars: ✭ 465 (-6.44%)
Mutual labels:  mock-server
Mockserver
Mockserver is a mock data tools and switch between mock data and real data,【一个用于前后分离时模拟数据的web系统,并可在直实数据与实际数据中自由切换】
Stars: ✭ 332 (-33.2%)
Mutual labels:  mock-server

puer-mock

NPM version changelog license

Puer + Mock.js = A configurable mock server with configurable mock(random) data.

Start a mock server never ever so easy and configurable, no code needed, you only need config some mock API route and some mock data template, it all done!

features

  • mock server
  • configurable RESTful API route
    • API request
    • API response mock data
    • validate API request params
  • effective immediately when config changed
  • JSONP support
  • CORS support
  • built-in API doc

install

Please install puer first.

Puer - more than a live-reload server , built for efficient frontend development

npm install [email protected] -g

And then install puer-mock package in your project root directory.

cd yourprojectdir
npm install puer-mock

If your project has a package.json file, suggest save puer-mock to devDependencies.

cd yourprojectrootdir
npm install puer-mock --save-dev

usage

  1. copy node_modules/puer-mock/example files to your project root directory

  2. cd yourprojectrootdir

  3. puer -a _mockserver.js

    You may define a npm script in package.json, then use npm run dev next time.

    "dev": "puer -a _mockserver.js"
    
  4. view mock API

  • open http://localhost:8000/api/configdemo-response/mock view mock API return mock data
  • open http://localhost:8000/api/configdemo-response/mock?callback=test view mock API return mock data by JSONP
  • open http://localhost:8000/_apidoc.html view built-in all mock API doc
  1. define your mock API in _mockserver.json
  2. view your mock API(Yes! it with immediate effect)

config

Config mock API in _mockserver.json.

The minimal _mockserver.json

{
    "api": {
        "GET /api/users": {
            "response": {}
        }
    }
}

Please view mockserver config doc for more detail info.

You can see more settings to config mock server in _mockserver.json.

  • comment is nice
  • config route and mock response data template is so easy
  • more data template please see Mock.js examples
  • disable a route is convenient
  • mock server will effective immediately when you changed _mockserver.json

customize

Customize launch mock server in _mockserver.js.

  • You may customize mock API doc

    • You may customize /_apidoc route direct service a more graceful doc

      // _mockserver.js
      module.exports = require('puer-mock')(null, null, function(mockConfig) {
          // 任你自由发挥
          return '<pre>' + JSON.stringify(mockConfig, null, 4) + '</pre>';
      });
      
    • You may customize /_apidoc.html which get mock API JSON from /_apidoc, you may totally implement it by yourself

  • You may customize config file and launch file

    If you do not use default _mockserver.json or _mockserver.js

    // use _mockserver2.json for config file
    //
    // _mockserver.js
    // puer -a _mockserver.js
    module.exports = require('puer-mock')(__filename, './_mockserver2.json');
    
    // use _mockserver2.js and _mockserver2.json
    //
    // _mockserver2.js
    // puer -a _mockserver2.js
    module.exports = require('puer-mock')(__filename, './_mockserver2.json');
    
  • Play it fun with your imagination.

    // _mockserver.js
    var puerMock = require('puer-mock');
    var routeConfig = puerMock();
    // 其实你完全可以这样来玩, 在这里接着定义 route 即可, 发挥你的想象力
    // 例如定义一个常用的 500 接口, 来测试服务器报错的情况
    routeConfig['GET /500'] = function(request, response, next) {
        response.status(500).end();
    };
    module.exports = routeConfig;
    

example

眼见为实耳听为虚, puer-mock 让你一秒钟就能拥有一个强大的 mock server, 所以请不要再自己手工做假数据了, 赶快尝试一下让你的工作效率翻番吧!

配置 API 并生成随机数据

puer-mock-example

查看所有的 API 接口文档

通过 /_apidoc.html 查看接口文档

puer-mock-api-doc-html

通过 /_apidoc 直接查看 JSON 数据, 即查看 mock server 配置了哪些 API(使用 FeHelper 插件 格式化了 JSON 数据)

puer-mock-api-doc

one more thing

谁需要这个工具

感谢 puer 提供了如此强大的 mock 机制, 感谢 Mock.js 带来的假数据, 我才有幸做了这么一个扩展工具.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].