mswjs / examples

Examples of Mock Service Worker usage with various frameworks and libraries.
685 stars 211 forks source link
api example examples graphql handler interceptor mock-service-worker mocking msw request response rest usage

Examples

A collection of usage examples of Mock Service Worker.

JavaScript frameworks

Test frameworks

Other tools

Reading examples

Each example is a standalone repository featuring the usage of MSW with a certain framework or tool. Follow the instructions written in the README.md of respective examples to integrate MSW with those particular technologies. Some examples have separate instructions for client-side and server-side integrations. You can choose either or both, depending on where you wish to gain control over the network with MSW. We highly recommend implementing both client-side and server-side interception to guarantee seamless development and testing experience.

Cloning examples

Each example can be forked immediately with CodeSandbox. To do so, click on the "Edit on CodeSandbox" button in the README.md of the respective example. This will load it in the cloud, allowing you to experiment with the integration and create reproduction cases easier.

Edit in CodeSandbox example