New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@charlietango/msw-fastify-middleware

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@charlietango/msw-fastify-middleware

Create a middleware for MSW to use with Fastify.

1.0.0
npm
Version published
Weekly downloads
14
-41.67%
Maintainers
2
Weekly downloads
 
Created
Source

@charlietango/msw-fastify-middleware

Create a middleware for MSW to use with Fastify.

Usage with SSR Vite

Load the async handlers inside the server file. They will be reloaded on change, so you get the latest data on every request.

app.all(
  "/api/*",
  mswFastifyMiddleware(async () => {
    const { handlers } = await vite.ssrLoadModule(
      "./src/api/mocks/handlers.ts"
    );
    return handlers;
  })
);

Params

  • handlers Handlers Set the MSW request handlers. Either as an array, or as an async function that returns the handlers.
  • handleRequestOptions Options to pass to the MSW handleRequest function.

FAQs

Package last updated on 06 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts