Mock Service Worker

Install

In this basic tutorial we are going to add Mock Service Worker to an existing Create React App application. You can follow the same steps from this tutorial to integrate MSW into your application regardless of the setup you have.

Install

Let's start by installing the msw package into our project.

Run the following command in your project's root directory:

1$ npm install msw --save-dev
2# or
3$ yarn add msw --dev

Next step

With the library installed, let's continue with defining which requests to mock.

Define mocks/docs/getting-started/mocks