React Application Architecture for Production by Alan Alickovic

React Application Architecture for Production by Alan Alickovic

Author:Alan Alickovic
Language: eng
Format: epub
Publisher: Packt
Published: 2023-01-15T00:00:00+00:00


Before getting started, let’s include all handlers in the configuration. Open the src/testing/mocks/handlers/index.ts file and change it to the following:

import { rest } from 'msw'; import { API_URL } from '@/config/constants'; import { authHandlers } from './auth'; import { jobsHandlers } from './jobs'; import { organizationsHandlers } from './organizations'; export const handlers = [ ...authHandlers, ...jobsHandlers, ...organizationsHandlers, rest.get(`${API_URL}/healthcheck`, (req, res, ctx) => { return res( ctx.status(200), ctx.json({ healthy: true }) ); }), ];

We are including all handlers we will define in each of the handlers’ files and make them available to MSW.

Now, we can start working on the request handlers for our application.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.