@visma/msw-openapi-backend-integration
v1.0.1
Published
Helper to integrate Mock Service Worker with OpenAPI Backend.
Downloads
270
Readme
@visma/msw-openapi-backend-integration
Helper to integrate Mock Service Worker with OpenAPI Backend.
Setup in Create React App
- Install:
npm i @visma/msw-openapi-backend-integration
- Follow Mock Service Worker instructions. In place of
handlers.js
, insrc/mocks/browser.js
use:
import { setupWorker } from 'msw';
import { handlers } from '@visma/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.