Coder Social home page Coder Social logo

yesmeck / macaca-datahub Goto Github PK

View Code? Open in Web Editor NEW

This project forked from macacajs/macaca-datahub

0.0 2.0 0.0 396 KB

Just enjoy the data out-of-the-box.πŸ“¦

Home Page: https://macacajs.github.io/zh/datahub

JavaScript 99.50% Dockerfile 0.48% Shell 0.03%

macaca-datahub's Introduction

Macaca

Macaca DataHub

δΈ­ζ–‡η‰ˆ


NPM version build status Test coverage node version npm download docker pull docker pull docker pull

Just enjoy the data out-of-the-box.πŸ“¦

Introduction

Macaca DataHub is a continuous data provider for development, testing, staging and production.

A Comprehensive Solution

DataHub is born to solving the lifecycle needs of mock/testing data of software development, from development, testing, staging to final production. Software engineers and test engineers use DataHub to manage their mock/testing data.

Decentralization

DataHub is flexible with how and where mock/testing data is stored.

You can use a local instance of Datahub on your local machine to manage your local testing/mock data during development. The mock/testing data is in plain text. It can be versioned and archived with any version control software, together with your project files.

In addition, the local mock/testing data can be pushed and synchronized to a remote Datahub server to meet the needs of data sharing and collaboration.

Data Flow Management

DataHub adopts the principle of unidirectional data flow to make sure you will always get the latest data.

Consistency Between API Document and Mock Data

Datahub can also automatically generate an API document from your mock/testing data, to help keep your API document up to date and consistent with your mock data.

DataHub Dashboard

DataHub adopts multi-scenario design, can group data according to the scene name, and provide scene data addition, deletion, and change, and can operate through DataHub's panel interface.

DataHub provides a dashboard for you to manage your data. You can group data by scene, or by stage such as development, testing, or staging. Datahub provides standard CRUD funtions.

Datahub use path-to-regexp for dynamic path matching.

API name example:

DataHub API name matched request path
api1/books api1/books
api2/:foo/:bar api2/group/project
api3/:id api3/fred
api3/:id api3/baz

Save Snapshot

DataHub can save the response of each request by taking snapshot. You can use the archieved snapshot to find out what happened.

More intro

Installation

Macaca datahub is distibuted through npm. To install it, run the following command line:

$ npm i macaca-datahub -g

Common Usage

Start datahub server

$ datahub server

The server will create backup files with prefix 'macaca-datahub.data-backup-' for the database periodically.

Run with docker

$ docker run -it -p 9200:9200 -p 9300:9300 macacajs/macaca-datahub

Configuration

key type description default
port Number port for DataHub server 9200
mode String mode for DataHub server 'prod'
protocol String protocol for DataHub server 'http'
database String path to file database $HOME
store String path to migrate directory undefined
view Object view layer config {}

Sample: macaca-datahub.config.js

module.exports = {
  mode: 'local',

  port: 7001,

  store: path.resolve(__dirname, 'data'),

  view: {
    // set assets base url
    assetsUrl: 'https://npmcdn.com/datahub-view@latest',
  },
};

Pass config file[.js|.json] to DataHub server.

$ datahub server -c path/to/config.js --verbose

Schema Syntax

DataHub use standard JSON schema syntax, schema must has the root node.

{
  "type": "object",
  "required": [
    "success"
  ],
  "properties": {
    "success": {
      "type": "boolean",
      "description": "server side success"
    },
    "data": {
      "type": "array",
      "description": "data field",
      "required": [
        "age",
        "key",
        "name",
        "address"
      ],
      "items": [
        {
          "type": "object",
          "required": [
            "name"
          ],
          "properties": {
            "key": {
              "type": "string",
              "description": "key description"
            },
            "name": {
              "type": "string",
              "description": "name description"
            },
            "age": {
              "type": "number",
              "description": "age description"
            },
            "address": {
              "type": "string",
              "description": "address description"
            }
          }
        }
      ]
    },
    "errorMessage": {
      "type": "string",
      "description": "error message description"
    }
  }
}

Project Integration

Quick start in your web project

Integration with webpack-dev-sever

More about datahub-proxy-middleware

Integration with Egg.js

More about egg-datahub

Integration with UmiJS

UmiJS is a blazing-fast next.js-like framework for React apps, and it's friendly to ant-design project.

Play Docker

Run as standalone just once service.

$ docker run -it --rm \
  --name macaca-datahub \
  -p 9200:9200 \
  -p 9300:9300 \
  macacajs/macaca-datahub

Run with existed DataHub's database in your host.

$ docker run -it --rm \
  --name macaca-datahub \
  -v $HOME/.macaca-datahub:/root/.macaca-datahub \
  -p 9200:9200 \
  -p 9300:9300 \
  macacajs/macaca-datahub

Run as a service.

$ docker run \
  --name macaca-datahub \
  -v $HOME/.macaca-datahub:/root/.macaca-datahub \
  -p 9200:9200 \
  -p 9300:9300 \
  -d macacajs/macaca-datahub

Build base image.

$ docker build --no-cache --pull -t="macacajs/macaca-datahub" .

SDKs

DataHub provides SDKs in multiple languages for easy integration with your test code.

Contributors


xudafeng


zhangyuheng


zivyangll


brucejcw


BernardTolosajr


Chan-Chun


atian25


gaius-qi

This project follows the git-contributor spec, auto upated at Sun Sep 02 2018 21:50:15 GMT+0800.

License

The MIT License (MIT)

macaca-datahub's People

Contributors

atian25 avatar bernardtolosajr avatar brucejcw avatar chan-chun avatar gaius-qi avatar xudafeng avatar zhangyuheng avatar zivyangll avatar

Watchers

 avatar  avatar

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.