kandi background
Explore Kits

easy-mock | persistent service that generates mock data | REST library

 by   easy-mock JavaScript Version: v1.6.0 License: GPL-3.0

 by   easy-mock JavaScript Version: v1.6.0 License: GPL-3.0

Download this library from

kandi X-RAY | easy-mock Summary

easy-mock is a JavaScript library typically used in Web Services, REST, Swagger applications. easy-mock has no bugs, it has no vulnerabilities, it has a Strong Copyleft License and it has medium support. You can download it from GitHub.
If you're unable to deploy an Easy Mock service by yourself, the online service is recommended. Easy Mock is a persistent service that generates mock data quickly and provids visualization view.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • easy-mock has a medium active ecosystem.
  • It has 8702 star(s) with 1330 fork(s). There are 227 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 153 open issues and 266 have been closed. On average issues are closed in 54 days. There are 21 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of easy-mock is v1.6.0
easy-mock Support
Best in #REST
Average in #REST
easy-mock Support
Best in #REST
Average in #REST

quality kandi Quality

  • easy-mock has 0 bugs and 0 code smells.
easy-mock Quality
Best in #REST
Average in #REST
easy-mock Quality
Best in #REST
Average in #REST

securitySecurity

  • easy-mock has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • easy-mock code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
easy-mock Security
Best in #REST
Average in #REST
easy-mock Security
Best in #REST
Average in #REST

license License

  • easy-mock is licensed under the GPL-3.0 License. This license is Strong Copyleft.
  • Strong Copyleft licenses enforce sharing, and you can use them when creating open source projects.
easy-mock License
Best in #REST
Average in #REST
easy-mock License
Best in #REST
Average in #REST

buildReuse

  • easy-mock releases are available to install and integrate.
  • Installation instructions, examples and code snippets are available.
easy-mock Reuse
Best in #REST
Average in #REST
easy-mock Reuse
Best in #REST
Average in #REST
Top functions reviewed by kandi - BETA

kandi has reviewed easy-mock and discovered the below as its top functions. This is intended to give you an instant insight into easy-mock implemented functionality, and help decide if they suit your requirements.

  • Broadcast event to all children

    Get all kandi verified functions for this library.

    Get all kandi verified functions for this library.

    easy-mock Key Features

    Support API proxying

    Convenient shortcuts

    Support Collaborative editing

    Support team project

    Support RESTful

    Support Swagger | OpenAPI Specification (1.2 & 2.0 & 3.0) Create project quickly based on Swagger Support displaying parameters and the return value Support displaying class model

    More flexible and extensible in response data

    Support for custom response configuration (example: status/headers/cookies)

    Use Mock.js schema

    Support restc to preview API

    Installation

    copy iconCopydownload iconDownload
    $ git clone https://github.com/easy-mock/easy-mock.git
    $ cd easy-mock && npm install
    

    Configuration

    copy iconCopydownload iconDownload
    {
      "port": 7300,
      "host": "0.0.0.0",
      "pageSize": 30,
      "proxy": false,
      "db": "mongodb://localhost/easy-mock",
      "unsplashClientId": "",
      "redis": {
        "keyPrefix": "[Easy Mock]",
        "port": 6379,
        "host": "localhost",
        "password": "",
        "db": 0
      },
      "blackList": {
        "projects": [], // projectId, e.g."5a4495e16ef711102113e500"
        "ips": [] // ip, e.g. "127.0.0.1"
      },
      "rateLimit": { // https://github.com/koajs/ratelimit
        "max": 1000,
        "duration": 1000
      },
      "jwt": {
        "expire": "14 days",
        "secret": "shared-secret"
      },
      "upload": {
        "types": [".jpg", ".jpeg", ".png", ".gif", ".json", ".yml", ".yaml"],
        "size": 5242880,
        "dir": "../public/upload",
        "expire": {
          "types": [".json", ".yml", ".yaml"],
          "day": -1
        }
      },
      "ldap": {
        "server": "", // Set server to enable LDAP login. e.g. "ldap://localhost:389" or "ldaps://localhost:389"(use SSL)
        "bindDN": "", // Username,e.g. "cn=admin,dc=example,dc=com"
        "password": "",
        "filter": {
          "base": "", // Base where we can search for users,e.g. "dc=example,dc=com"
          "attributeName": "" // e.g. "mail" or "email" etc.
        }
      },
      "fe": {
        "copyright": "",
        "storageNamespace": "easy-mock_",
        "timeout": 25000,
        "publicPath": "/dist/"
      }
    }
    

    Launch

    copy iconCopydownload iconDownload
    $ npm run dev
    # Visit http://127.0.0.1:7300
    

    More Commands

    copy iconCopydownload iconDownload
    # Build front-end assets
    $ npm run build
    
    # Run Easy Mock as production environment (You should run `build` first)
    $ npm run start
    
    # Run unit test
    $ npm run test
    
    # Test lint
    $ npm run lint
    

    PM2

    copy iconCopydownload iconDownload
    $ [sudo] npm install pm2 -g
    

    How to return a list of results in jOOQ Mocked Data

    copy iconCopydownload iconDownload
    var result = ctx.newResult(BICYCLES.COL1, BICYCLES.COL2);
    result.add(ctx.newRecord(BICYCLES.COL1, BICYCLES.COL2).values(1, 2));
    result.add(ctx.newRecord(BICYCLES.COL1, BICYCLES.COL2).values(3, 4));
    ...
    

    Why I get pending from this function

    copy iconCopydownload iconDownload
    async function test() {
        const res = await fetch('https://www.easy-mock.com/mock/5c6d317e8d040716434d0a5b/reading/category/homeSmallCategory');
        console.log(res) // data
        return res;
    }
    console.log(test()) // Promise {<pending>}
    
    test().then(res => console.log(res))
    
    const res = await test();
    console.log(res)
    
    async function test() {
        const res = await fetch('https://www.easy-mock.com/mock/5c6d317e8d040716434d0a5b/reading/category/homeSmallCategory');
        console.log(res) // data
        return res;
    }
    console.log(test()) // Promise {<pending>}
    
    test().then(res => console.log(res))
    
    const res = await test();
    console.log(res)
    
    async function test() {
        const res = await fetch('https://www.easy-mock.com/mock/5c6d317e8d040716434d0a5b/reading/category/homeSmallCategory');
        console.log(res) // data
        return res;
    }
    console.log(test()) // Promise {<pending>}
    
    test().then(res => console.log(res))
    
    const res = await test();
    console.log(res)
    
    async function test() {
        const res = await fetch('https://www.easy-mock.com/mock/5c6d317e8d040716434d0a5b/reading/category/homeSmallCategory');
        return res;
    }
    test().then(ok => {console.log(ok)}, not_ok => {console.log(not_ok)});

    Community Discussions

    Trending Discussions on easy-mock
    • How to return a list of results in jOOQ Mocked Data
    • Why I get pending from this function
    Trending Discussions on easy-mock

    QUESTION

    How to return a list of results in jOOQ Mocked Data

    Asked 2019-Jun-07 at 13:20

    I'm using jOOQ's MockDataProvider to mock calls to the database. I've figured out how to return a single record using the information here: https://blog.jooq.org/2013/02/20/easy-mocking-of-your-database/

    However, I want to return a list of results not just a single record for my query. How do I do that?

    I can use the following (from the above link) to return a single result:

    return new MockResult[] {
      new MockResult(1, result)
    };
    

    However, I cannot figure out how to add multiple results, all of the constructors for MockResult only take a single result. Any hints? Am I missing something obvious?

    For example if I query all bicycles that are road bikes: SELECT * FROM bicycles WHERE type = "road"; how do I return a list of 10 bicycles instead of just one?

    ANSWER

    Answered 2019-Jun-07 at 13:20

    I can use the following (from the above link) to return a single result

    But that's already it. You return a single result with several records. The result you pass to that MockResult constructor could look like this:

    var result = ctx.newResult(BICYCLES.COL1, BICYCLES.COL2);
    result.add(ctx.newRecord(BICYCLES.COL1, BICYCLES.COL2).values(1, 2));
    result.add(ctx.newRecord(BICYCLES.COL1, BICYCLES.COL2).values(3, 4));
    ...
    

    Source https://stackoverflow.com/questions/56483152

    Community Discussions, Code Snippets contain sources that include Stack Exchange Network

    Vulnerabilities

    No vulnerabilities reported

    Install easy-mock

    Before starting, we assume that you're already have installed Node.js (v8.x, ~~v10.x is not supported~~) & MongoDB (>= v3.4) & Redis(>= v4.0).

    Support

    简体中文介绍Online ManualEasy Mock CLI - A command line tool to generate an api.js file quickly based on Easy Mock.

    DOWNLOAD this Library from

    Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
    over 430 million Knowledge Items
    Find more libraries
    Reuse Solution Kits and Libraries Curated by Popular Use Cases
    Explore Kits

    Save this library and start creating your kit

    Explore Related Topics

    Share this Page

    share link
    Reuse Pre-built Kits with easy-mock
    Consider Popular REST Libraries
    Try Top Libraries by easy-mock
    Compare REST Libraries with Highest Support
    Compare REST Libraries with Highest Quality
    Compare REST Libraries with Highest Security
    Compare REST Libraries with Permissive License
    Compare REST Libraries with Highest Reuse
    Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
    over 430 million Knowledge Items
    Find more libraries
    Reuse Solution Kits and Libraries Curated by Popular Use Cases
    Explore Kits

    Save this library and start creating your kit

    • © 2022 Open Weaver Inc.