1.2.4 • Published 1 year ago

mockios v1.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

mockios

A library that helps run-time testing by putting fake data instead of Axios.

Installing

When use npm

$ npm install --save-dev mockios

When use yarn

$ yarn add --dev mockios

How to use

CodeSandBox example

import axios from "axios";
import mockios, { MockDataType } from "mockios";

const mockData: MockDataType = {
  get: {
    // method
    "/hello": [
      // url
      { ok: true, message: "hello world" }, // response body
      { baseURL: "http://localhost:3000" }, // response config
    ],
  },
};

const query =
  process.env.NODE_ENV === "development" ? mockios(mockData) : axios;

query.get("/hello").then(({ data }) => {
  console.log(data); // { ok: true, message: 'hello world' }
});
1.2.0

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago