@twoday/msw-openapi-backend-integration

1.0.1 • Public • Published

@twoday/msw-openapi-backend-integration

Helper to integrate Mock Service Worker with OpenAPI Backend.

TodoMVC example

Setup in Create React App

  1. Install: npm i @twoday/msw-openapi-backend-integration
  2. Follow Mock Service Worker instructions. In place of handlers.js, in src/mocks/browser.js use:
import { setupWorker } from 'msw';
import { handlers } from '@twoday/msw-openapi-backend-integration';
import definition from '../petstore.json';

export const worker = setupWorker(...handlers({ definition }));

For dynamic responses and mutations, see requestLogicHandlers in TodoMVC example source.

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @twoday/msw-openapi-backend-integration

    Weekly Downloads

    1

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    3.07 kB

    Total Files

    4

    Last publish

    Collaborators

    • sigurs
    • arnosaine